Optimize-Offline Guide - Windows Debloating Tool, Windows 1803, 1903, 19H2, 1909, 20H1 and LTSC 2019

Discussion in 'Windows 10' started by KedarWolf, Jul 30, 2019.

  1. Angela Pszbor

    Angela Pszbor MDL Senior Member

    Apr 11, 2014
    297
    85
    10
  2. drew84

    drew84 MDL Expert

    Mar 13, 2014
    1,354
    2,308
    60
    .. not sure if you are aware, but.. This thread is a discussion about Godhand's Optimize-Offline Tool

    Judging by your last two posts, it looks as if you've never used it (or don't know how to use it, properly)

    There is no need for any other 'AppRemover' tool, as you can remove any apps you desire with O-O, prior to installation
    .. and as spanishfly says, the same can be done with any registry entries you use.
     
  3. zbigniew59

    zbigniew59 MDL Senior Member

    May 14, 2016
    374
    171
    10
    #423 zbigniew59, Apr 22, 2020
    Last edited: Apr 22, 2020
  4. spanishfly

    spanishfly MDL Senior Member

    Dec 5, 2018
    352
    527
    10
    Function scripts are a bit weird until you realize that you can "call" the function from the same file you saved it to by just adding the function name and any parameters at the bottom of the page below the function.
    I've not used the script you refer to, but you would put:
    Remove-OneDrive or Remove-OneDrive -RemoveComponents at the bottom of the page after
    Code:
    "Else { Write-Warning "Elevation is required to remove Microsoft OneDrive. Please relaunch this script as an administrator."; Start-Sleep 3; Exit }"
    Then save the whole thing as "KillOneDrive.ps1" and run it elevated.
    To get a bit more fancy--though I'm not sure it's necessary--you can wrap the function in some code that I lifted from an old optimize-offline ps1 script
    Code:
    #region Helper Functions
    Function Remove-OneDrive
    {
    blah-blah paste function here
    ..
    ..
    }
    
    If (([Security.Principal.WindowsPrincipal][Security.Principal.WindowsIdentity]::GetCurrent()).IsInRole([Security.Principal.WindowsBuiltInRole]::Administrator)) { Remove-OneDrive }
    Else { Write-Warning "Elevation is required to remove Microsoft OneDrive. Please relaunch this script as an administrator."; Start-Sleep 3; Exit }
    #endregion Helper Functions
    
    Remove-OneDrive -RemoveComponents

    If you want OneDrive dormant, but available, than the only way I've found to do that is offline.
    I add a few lines of code to the optimize-offline's "Set-RegistryProperties.ps1"
    To have evidence in the log file, I add a line to "Set-RegistryProperties.strings.psd1"
    Code:
    $RegistryData.DisableOnedrive | Out-File -FilePath $RegistryLog -Encoding UTF8 -Append -Force
    Remove-ItemProperty -Path "HKLM:\WIM_HKCU\SOFTWARE\Microsoft\Windows\CurrentVersion\Run" -Name "OneDriveSetup" -Force -ErrorAction SilentlyContinue
    Code:
    DisableOnedrive                     = [My addition] Disabling OneDrive from installing unless I ask for it.
     
    Stop hovering to collapse... Click to collapse... Hover to expand... Click to expand...
  5. LeoKesler

    LeoKesler MDL Novice

    Feb 11, 2008
    14
    4
    0
    What option I need to keep or set to maintain the setup files to upgrade an already installed system ?
    I only able to make a clean install.
     
  6. Mavericks Choice

    Mavericks Choice MDL Guru

    Aug 5, 2015
    2,914
    12,497
    90
    Do what I do, copy your optimized install.wim & boot.wim back into your original win 10 media source & your good to go.
     
  7. spanishfly

    spanishfly MDL Senior Member

    Dec 5, 2018
    352
    527
    10
    Stop hovering to collapse... Click to collapse... Hover to expand... Click to expand...
  8. Thread title must have 2004 also added as its showing supported till 1909 .
    As per developer builds 2004 is fully supported since 4.0.0.9 .
    Hence this thread creator must update it to 2004 or might be 19041 .
     
  9. spanishfly

    spanishfly MDL Senior Member

    Dec 5, 2018
    352
    527
    10
    #430 spanishfly, Apr 27, 2020
    Last edited: Jul 24, 2021
    Stop hovering to collapse... Click to collapse... Hover to expand... Click to expand...
  10. drew84

    drew84 MDL Expert

    Mar 13, 2014
    1,354
    2,308
    60
    Just what I was looking for, Concise and easy to follow.... nice effort
     
  11. jbh1145

    jbh1145 MDL Novice

    Sep 10, 2015
    2
    0
    0
    #432 jbh1145, Apr 27, 2020
    Last edited: Apr 27, 2020
    Got these errors in the log when the optimization finished. Is there anything to be concerned about? I removed "DaRT": "Setup" like in the OP's post so idk if these have to do with that.

    Index : 0
    Exception : Could not find a part of the path 'C:\Users\\Downloads\Optimize-Offline-4.0.0.10\OfflineTemp_1097403
    281\en_windows_10_consumer_editions_version_1909_updated_april_2020_x64_dvd_aa12b363\sources\replacementman
    ifests\microsoft-windows-security-ngc-localaccountmigplugin\ngclocalaccountmigplugin.dll'.
    Category : NotSpecified: :)) [Copy-Item], DirectoryNotFoundException
    ErrorID : System.IO.DirectoryNotFoundException,Microsoft.PowerShell.Commands.CopyItemCommand
    Target :
    Command : Copy-Item -Path $Item.FullName -Destination $ISOExport
    Script : C:\Users\\Downloads\Optimize-Offline-4.0.0.10\Optimize-Offline.psm1
    Line : 125
    Column : 6

    Index : 1
    Exception : Could not find a part of the path 'C:\Users\\Downloads\Optimize-Offline-4.0.0.10\OfflineTemp_1097403
    281\en_windows_10_consumer_editions_version_1909_updated_april_2020_x64_dvd_aa12b363\sources\replacementman
    ifests\microsoft-windows-appx-deployment-server\windows.miracastview_6.3.0.0_neutral_neutral_cw5n1h2txyewy.
    xml'.
    Category : NotSpecified: :)) [Copy-Item], DirectoryNotFoundException
    ErrorID : System.IO.DirectoryNotFoundException,Microsoft.PowerShell.Commands.CopyItemCommand
    Target :
    Command : Copy-Item -Path $Item.FullName -Destination $ISOExport
    Script : C:\Users\\Downloads\Optimize-Offline-4.0.0.10\Optimize-Offline.psm1
    Line : 125
    Column : 6

    Index : 2
    Exception : Could not find a part of the path 'C:\Users\\Downloads\Optimize-Offline-4.0.0.10\OfflineTemp_1097403
    281\en_windows_10_consumer_editions_version_1909_updated_april_2020_x64_dvd_aa12b363\sources\replacementman
    ifests\microsoft-windows-appx-deployment-server\microsoft.windows.secondarytileexperience_10.0.0.0_neutral_
    _cw5n1h2txyewy.xml'.
    Category : NotSpecified: :)) [Copy-Item], DirectoryNotFoundException
    ErrorID : System.IO.DirectoryNotFoundException,Microsoft.PowerShell.Commands.CopyItemCommand
    Target :
    Command : Copy-Item -Path $Item.FullName -Destination $ISOExport
    Script : C:\Users\\Downloads\Optimize-Offline-4.0.0.10\Optimize-Offline.psm1
    Line : 125
    Column : 6

    Index : 3
    Exception : Could not find a part of the path 'C:\Users\\Downloads\Optimize-Offline-4.0.0.10\OfflineTemp_1097403
    281\en_windows_10_consumer_editions_version_1909_updated_april_2020_x64_dvd_aa12b363\sources\replacementman
    ifests\microsoft-windows-powershellwebaccess-commands-powershell-migration-replacement.man'.
    Category : NotSpecified: :)) [Copy-Item], DirectoryNotFoundException
    ErrorID : System.IO.DirectoryNotFoundException,Microsoft.PowerShell.Commands.CopyItemCommand
    Target :
    Command : Copy-Item -Path $Item.FullName -Destination $ISOExport
    Script : C:\Users\\Downloads\Optimize-Offline-4.0.0.10\Optimize-Offline.psm1
    Line : 125
    Column : 6

    Index : 4
    Exception : Could not find a part of the path 'C:\Users\\Downloads\Optimize-Offline-4.0.0.10\OfflineTemp_1097403
    281\en_windows_10_consumer_editions_version_1909_updated_april_2020_x64_dvd_aa12b363\sources\dlmanifests\mi
    crosoft-windows-ie-clientnetworkprotocolimplementation-migration\wininetplugin.dll'.
    Category : NotSpecified: :)) [Copy-Item], DirectoryNotFoundException
    ErrorID : System.IO.DirectoryNotFoundException,Microsoft.PowerShell.Commands.CopyItemCommand
    Target :
    Command : Copy-Item -Path $Item.FullName -Destination $ISOExport
    Script : C:\Users\\Downloads\Optimize-Offline-4.0.0.10\Optimize-Offline.psm1
    Line : 125
    Column : 6
     
  12. drew84

    drew84 MDL Expert

    Mar 13, 2014
    1,354
    2,308
    60
  13. drew84

    drew84 MDL Expert

    Mar 13, 2014
    1,354
    2,308
    60
    @jbh1145 ... don't quote me on this, but...

    I am not sure that O-O is designed to be run on a mult index image (without designating an index to be optimized),
    which is what you appear to be doing..

    .. also you may want to shorten the image path and/or filename , as you could be running into issues there as well. ...
    always found it better (less of a hinderance) to run these scripts from root (other than OS drive)
     
  14. KedarWolf

    KedarWolf MDL Addicted

    Mar 17, 2016
    977
    870
    30
    Do the below if you want to have Cortana and WebSearch Enabled on your ISO.

    Right click on D:\Optimize-Offline-4.0.0.10\Src\Public\Set-RegistryProperties.ps1 and choose 'Edit" or open in Notepad++. Don't use the regular Windows Notepad to edit any files, it breaks the encoding when you save them.

    Delete the below code.

    Code:
    $RegistryData.DisableCortana | Out-File -FilePath $RegistryLog -Encoding UTF8 -Append -Force
            If ($InstallInfo.Build -ge '18362') { RegKey -Path "HKLM:\WIM_HKCU\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\Advanced" -Name "ShowCortanaButton" -Value 0 -Type DWord }
            RegKey -Path "HKLM:\WIM_HKCU\SOFTWARE\Microsoft\Windows\CurrentVersion\Search" -Name "BingSearchEnabled" -Value 0 -Type DWord
            RegKey -Path "HKLM:\WIM_HKCU\SOFTWARE\Microsoft\Windows\CurrentVersion\Search" -Name "CortanaConsent" -Value 0 -Type DWord
            RegKey -Path "HKLM:\WIM_HKCU\SOFTWARE\Microsoft\Windows\CurrentVersion\Search" -Name "CortanaInAmbientMode" -Value 0 -Type DWord
            RegKey -Path "HKLM:\WIM_HKCU\SOFTWARE\Microsoft\Windows\CurrentVersion\Search" -Name "HistoryViewEnabled" -Value 0 -Type DWord
            RegKey -Path "HKLM:\WIM_HKCU\SOFTWARE\Microsoft\Windows\CurrentVersion\Search" -Name "HasAboveLockTips" -Value 0 -Type DWord
            RegKey -Path "HKLM:\WIM_HKCU\SOFTWARE\Microsoft\Windows\CurrentVersion\Search" -Name "AllowSearchToUseLocation" -Value 0 -Type DWord
            RegKey -Path "HKLM:\WIM_HKLM_SOFTWARE\Policies\Microsoft\Windows\Windows Search" -Name "AllowCortana" -Value 0 -Type DWord
            RegKey -Path "HKLM:\WIM_HKLM_SOFTWARE\Policies\Microsoft\Windows\Windows Search" -Name "DisableWebSearch" -Value 1 -Type DWord
            RegKey -Path "HKLM:\WIM_HKLM_SOFTWARE\Policies\Microsoft\Windows\Windows Search" -Name "ConnectedSearchUseWeb" -Value 0 -Type DWord
            RegKey -Path "HKLM:\WIM_HKLM_SOFTWARE\Policies\Microsoft\Windows\Windows Search" -Name "ConnectedSearchUseWebOverMeteredConnections" -Value 0 -Type DWord
            RegKey -Path "HKLM:\WIM_HKLM_SOFTWARE\Policies\Microsoft\Windows\Windows Search" -Name "AllowCloudSearch" -Value 0 -Type DWord
            RegKey -Path "HKLM:\WIM_HKCU\SOFTWARE\Microsoft\InputPersonalization" -Name "RestrictImplicitTextCollection" -Value 1 -Type DWord
            RegKey -Path "HKLM:\WIM_HKCU\SOFTWARE\Microsoft\InputPersonalization" -Name "RestrictImplicitInkCollection" -Value 1 -Type DWord
            RegKey -Path "HKLM:\WIM_HKCU\SOFTWARE\Microsoft\InputPersonalization\TrainedDataStore" -Name "AcceptedPrivacyPolicy" -Value 0 -Type DWord
            RegKey -Path "HKLM:\WIM_HKCU\SOFTWARE\Microsoft\InputPersonalization\TrainedDataStore" -Name "HarvestContacts" -Value 0 -Type DWord
            RegKey -Path "HKLM:\WIM_HKCU\SOFTWARE\Microsoft\Personalization\Settings" -Name "AcceptedPrivacyPolicy" -Value 0 -Type DWord
            RegKey -Path "HKLM:\WIM_HKLM_SOFTWARE\Microsoft\Speech_OneCore\Preferences" -Name "VoiceActivationDefaultOn" -Value 0 -Type DWord
            RegKey -Path "HKLM:\WIM_HKLM_SOFTWARE\Microsoft\Speech_OneCore\Preferences" -Name "VoiceActivationEnableAboveLockscreen" -Value 0 -Type DWord
            RegKey -Path "HKLM:\WIM_HKLM_SOFTWARE\Microsoft\Speech_OneCore\Preferences" -Name "ModelDownloadAllowed" -Value 0 -Type DWord
            RegKey -Path "HKLM:\WIM_HKLM_SOFTWARE\Microsoft\Windows\CurrentVersion\OOBE" -Name "DisableVoice" -Value 1 -Type DWord
            RegKey -Path "HKLM:\WIM_HKLM_SYSTEM\ControlSet001\Services\SharedAccess\Parameters\FirewallPolicy\FirewallRules" -Name "Block Cortana ActionUriServer.exe" -Value "v2.26|Action=Block|Active=TRUE|Dir=Out|RA42=IntErnet|RA62=IntErnet|App=C:\Windows\SystemApps\Microsoft.Windows.Cortana_cw5n1h2txyewy\ActionUriServer.exe|Name=Block Cortana ActionUriServer.exe|Desc=Block Cortana Outbound UDP/TCP Traffic|" -Type String
            RegKey -Path "HKLM:\WIM_HKLM_SYSTEM\ControlSet001\Services\SharedAccess\Parameters\FirewallPolicy\FirewallRules" -Name "Block Cortana PlacesServer.exe" -Value "v2.26|Action=Block|Active=TRUE|Dir=Out|RA42=IntErnet|RA62=IntErnet|App=C:\Windows\SystemApps\Microsoft.Windows.Cortana_cw5n1h2txyewy\PlacesServer.exe|Name=Block Cortana PlacesServer.exe|Desc=Block Cortana Outbound UDP/TCP Traffic|" -Type String
            RegKey -Path "HKLM:\WIM_HKLM_SYSTEM\ControlSet001\Services\SharedAccess\Parameters\FirewallPolicy\FirewallRules" -Name "Block Cortana RemindersServer.exe" -Value "v2.26|Action=Block|Active=TRUE|Dir=Out|RA42=IntErnet|RA62=IntErnet|App=C:\Windows\SystemApps\Microsoft.Windows.Cortana_cw5n1h2txyewy\RemindersServer.exe|Name=Block Cortana RemindersServer.exe|Desc=Block Cortana Outbound UDP/TCP Traffic|" -Type String
            RegKey -Path "HKLM:\WIM_HKLM_SYSTEM\ControlSet001\Services\SharedAccess\Parameters\FirewallPolicy\FirewallRules" -Name "Block Cortana RemindersShareTargetApp.exe" -Value "v2.26|Action=Block|Active=TRUE|Dir=Out|RA42=IntErnet|RA62=IntErnet|App=C:\Windows\SystemApps\Microsoft.Windows.Cortana_cw5n1h2txyewy\RemindersShareTargetApp.exe|Name=Block Cortana RemindersShareTargetApp.exe|Desc=Block Cortana Outbound UDP/TCP Traffic|" -Type String
            RegKey -Path "HKLM:\WIM_HKLM_SYSTEM\ControlSet001\Services\SharedAccess\Parameters\FirewallPolicy\FirewallRules" -Name "Block Cortana SearchUI.exe" -Value "v2.26|Action=Block|Active=TRUE|Dir=Out|RA42=IntErnet|RA62=IntErnet|App=C:\Windows\SystemApps\Microsoft.Windows.Cortana_cw5n1h2txyewy\SearchUI.exe|Name=Block Cortana SearchUI.exe|Desc=Block Cortana Outbound UDP/TCP Traffic|" -Type String
            RegKey -Path "HKLM:\WIM_HKLM_SYSTEM\ControlSet001\Services\SharedAccess\Parameters\FirewallPolicy\FirewallRules" -Name "Block Cortana Package" -Value "v2.26|Action=Block|Active=TRUE|Dir=Out|RA42=IntErnet|RA62=IntErnet|Name=Block Cortana Package|Desc=Block Cortana Outbound UDP/TCP Traffic|AppPkgId=S-1-15-2-1861897761-1695161497-2927542615-642690995-327840285-2659745135-2630312742|Platform=2:6:2|Platform2=GTEQ|" -Type String
    
    Then backspace until there is only one space between 'RegHives -Load' and the line below it like below.

    Code:
            RegHives -Load
    
            $RegistryData.DisableTelemetry | Out-File -FilePath $RegistryLog -Encoding UTF8 -Append -Force
            If ($DynamicParams.LTSC -or $InstallInfo.Name -like "*Enterprise*" -or $InstallInfo.Name -like "*Education*") { $TelemetryLevel = 0 } Else { $TelemetryLevel = 1 }
            RegKey -Path "HKLM:\WIM_HKLM_SOFTWARE\Microsoft\Windows\CurrentVersion\Policies\DataCollection" -Name "AllowTelemetry" -Value $TelemetryLevel -Type DWord
            RegKey -Path "HKLM:\WIM_HKLM_SOFTWARE\Policies\Microsoft\Windows\DataCollection" -Name "AllowTelemetry" -Value $TelemetryLevel -Type DWord
            RegKey -Path "HKLM:\WIM_HKLM_SOFTWARE\Policies\Microsoft\Windows\DataCollection" -Name "DoNotShowFeedbackNotifications" -Value 1 -Type DWord
            RegKey -Path "HKLM:\WIM_HKCU\SOFTWARE\Policies\Microsoft\Windows\CloudContent" -Name "DisableTailoredExperiencesWithDiagnosticData" -Value 1 -Type DWord
            RegKey -Path "HKLM:\WIM_HKLM_SOFTWARE\Policies\Microsoft\Windows\AppCompat" -Name "AITEnable" -Value 0 -Type DWord
            RegKey -Path "HKLM:\WIM_HKLM_SOFTWARE\Policies\Microsoft\Windows\AppCompat" -Name "DisableInventory" -Value 1 -Type DWord
            RegKey -Path "HKLM:\WIM_HKLM_SOFTWARE\Policies\Microsoft\Windows\AppCompat" -Name "DisablePCA" -Value 1 -Type DWord
            RegKey -Path "HKLM:\WIM_HKLM_SOFTWARE\Policies\Microsoft\Windows\AppCompat" -Name "DisableUAR" -Value 1 -Type DWord
            RegKey -Path "HKLM:\WIM_HKLM_SOFTWARE\Policies\Microsoft\Windows\Messaging" -Name "AllowMessageSync" -Value 0 -Type DWord
            RegKey -Path "HKLM:\WIM_HKLM_SOFTWARE\Policies\Microsoft\Messenger\Client" -Name "CEIP" -Value 2 -Type DWord
            RegKey -Path "HKLM:\WIM_HKCU\SOFTWARE\Policies\Microsoft\Messenger\Client" -Name "CEIP" -Value 2 -Type DWord
            RegKey -Path "HKLM:\WIM_HKLM_SOFTWARE\Policies\Microsoft\AppV\CEIP" -Name "CEIPEnable" -Value 0 -Type DWord
            RegKey -Path "HKLM:\WIM_HKLM_SOFTWARE\Policies\Microsoft\SQMClient\Windows" -Name "CEIPEnable" -Value 0 -Type DWord
            RegKey -Path "HKLM:\WIM_HKLM_SOFTWARE\Policies\Microsoft\Internet Explorer\SQM" -Name "DisableCustomerImprovementProgram" -Value 0 -Type DWord
            RegKey -Path "HKLM:\WIM_HKLM_SOFTWARE\Policies\Microsoft\Windows\TabletPC" -Name "PreventHandwritingDataSharing" -Value 1 -Type DWord
            RegKey -Path "HKLM:\WIM_HKLM_SOFTWARE\Policies\Microsoft\Windows NT\CurrentVersion\Software Protection Platform" -Name "NoGenTicket" -Value 1 -Type DWord
            RegKey -Path "HKLM:\WIM_HKLM_SOFTWARE\Microsoft\Windows\CurrentVersion\Policies\TextInput" -Name "AllowLinguisticDataCollection" -Value 0 -Type DWord
            RegKey -Path "HKLM:\WIM_HKCU\SOFTWARE\Microsoft\Windows\CurrentVersion\Privacy" -Name "TailoredExperiencesWithDiagnosticDataEnabled" -Value 0 -Type DWord
            RegKey -Path "HKLM:\WIM_HKLM_SOFTWARE\Microsoft\PolicyManager\default\System\AllowExperimentation" -Name "value" -Value 0 -Type DWord
            RegKey -Path "HKLM:\WIM_HKCU\Control Panel\International\User Profile" -Name "HttpAcceptLanguageOptOut" -Value 1 -Type DWord
            RegKey -Path "HKLM:\WIM_HKLM_SOFTWARE\Policies\Microsoft\Windows\DeliveryOptimization" -Name "DODownloadMode" -Value 100 -Type DWord
            RegKey -Path "HKLM:\WIM_HKLM_SOFTWARE\Policies\Microsoft\WindowsInkWorkspace" -Name "AllowWindowsInkWorkspace" -Value 0 -Type DWord
            RegKey -Path "HKLM:\WIM_HKLM_SOFTWARE\Policies\Microsoft\WindowsInkWorkspace" -Name "AllowSuggestedAppsInWindowsInkWorkspace" -Value 0 -Type DWord
            RegKey -Path "HKLM:\WIM_HKCU\SOFTWARE\Microsoft\Input\TIPC" -Name "Enabled" -Value 0 -Type DWord
            RegKey -Path "HKLM:\WIM_HKCU\SOFTWARE\Policies\Microsoft\Windows\AdvertisingInfo" -Name "DisabledByGroupPolicy" -Value 1 -Type DWord
            RegKey -Path "HKLM:\WIM_HKCU\SOFTWARE\Microsoft\Windows\CurrentVersion\AdvertisingInfo" -Name "Enabled" -Value 0 -Type DWord
            RegKey -Path "HKLM:\WIM_HKLM_SOFTWARE\Microsoft\Windows\Windows Error Reporting" -Name "Disabled" -Value 1 -Type DWord
    
    Next, delete this line in D:\Optimize-Offline-4.0.0.10\Src\Public\en-GB\Set-RegistryProperties.strings.psd1 and backspace and remove the space left when you delete it.

    Code:
    DisableCortana                      = Disabling Cortana and Search Bar Web Connectivity.
    

    Cortana and WebSearch should be enabled. I haven't actually tested it though, but if someone does, let me know if everything works okay. I like the default Cortana disabled etc, fewer things Microsoft can spy on you with.
     
  15. Kindly cross check 20H1 written correctly in forum thread name . it seems like 2H01
     
  16. mongtay

    mongtay MDL Novice

    Oct 6, 2018
    3
    0
    0
    Can i use it to removal OneDrive?
     
  17. Wazoo

    Wazoo MDL Addicted

    Nov 5, 2013
    513
    273
    30
    Stop hovering to collapse... Click to collapse... Hover to expand... Click to expand...