Skip to content

Instantly share code, notes, and snippets.

@halkyon
Last active April 14, 2025 19:38

Revisions

  1. Sean Harvey revised this gist Jul 17, 2019. 1 changed file with 12 additions and 37 deletions.
    49 changes: 12 additions & 37 deletions cleanup-win10.ps1
    Original file line number Diff line number Diff line change
    @@ -1,23 +1,18 @@
    ##
    ## Windows 10 cleanup script.
    ## Remove dodgy tracking settings, unneeded services, all apps, and optional features that come with Windows 10. Make it more like Windows 7.
    ## WARNING: UNTESTED AND MAY NOT WORK ON ANY VERSION BEYOND WINDOWS 10 CREATORS UPDATE (Version 1703)!
    ## NOTE: this was tested on Creators Update (1703) and Fall Creators Update (1709). Some of this may not work as expected on newer versions.
    ##
    ## Instructions
    ## 1. Start Windows 10 installation. At the first point you are asked for input during Windows 10 setup, hit Shift-F10. This gives you a command prompt.
    ## 2. Now mount a network volume, or insert a USB key with this script on it and change directory to it. e.g.
    ## net use x: \\mynetworkmount
    ## cd x:
    ## 3. Run the script
    ## powershell -ExectionPolicy Bypass cleanup-win10.ps1
    ## 4. Let it run through, you may see a few errors, this is normal
    ## 5. Reboot
    ## 1. Run this script (under Powershell as Administrator):
    ## powershell -ExectionPolicy Bypass .\cleanup-win10.ps1
    ## 2. Let it run through, you may see a few errors, this is normal
    ## 3. Reboot
    ## shutdown /r /t 0
    ## 6. Contine installation as normal
    ## 7. Once you login for the first time, run this script again (under Powershell as Administrator):
    ## powershell -ExectionPolicy Bypass cleanup-win10.ps1
    ## 8. Go through the "Things to do after" shown at the end of the script
    ## 9. Done!
    ## 5. Done!
    ##
    ## After using this script, I would recommend running O&O Shutup.
    ## You can find it here: https://www.oo-software.com/en/shutup10
    ##

    New-PSDrive -Name HKCR -PSProvider Registry -Root HKEY_CLASSES_ROOT
    @@ -39,10 +34,9 @@ New-ItemProperty -Path 'HKCU:\Software\Microsoft\Windows\CurrentVersion\Explorer
    New-ItemProperty -Path 'HKCU:\Software\Microsoft\Windows\CurrentVersion\Explorer\Advanced' -Name 'Hidden' -PropertyType DWord -Value '1' -Force
    New-ItemProperty -Path 'HKCU:\Software\Microsoft\Windows\CurrentVersion\Explorer\Advanced' -Name 'ShowSyncProviderNotifications' -PropertyType DWord -Value '0' -Force

    # Remove all Windows 10 apps, including Windows Store. You may not want this, but I don't ever use any of the apps or the start menu tiles.
    # This makes Windows 10 similar to Windows 7. Don't forget to unpin all the tiles after installation to trim down the start menu!
    Get-AppxProvisionedPackage -Online | Remove-AppxProvisionedPackage -Online
    Get-AppxPackage | Remove-AppxPackage
    # Remove all Windows 10 apps, except the Windows Store
    Get-AppxProvisionedPackage –Online | Where-Object {$_.packagename –NotLike "*store*"} | Remove-AppxProvisionedPackage -Online
    Get-AppxPackage -AllUsers | Where-Object {$_.name –NotLike "*store*"} | Remove-AppxPackage

    # Disable Cortana, and disable any kind of web search or location settings.
    New-Item -Path 'HKLM:\SOFTWARE\Policies\Microsoft\Windows\' -Name 'Windows Search'
    @@ -176,22 +170,3 @@ $features = @(
    foreach ($feature in $features) {
    Disable-WindowsOptionalFeature -Online -FeatureName $feature -NoRestart
    }

    Write-Host 'Finished. Reboot system with: shutdown /r /t 0'
    Write-Host ''
    Write-Host '***'
    Write-Host 'If you ran this script during installation, make sure to run it again after logging in for the first time!'
    Write-Host '***'
    Write-Host ''
    Write-Host '***'
    Write-Host 'Things to do after you have logged in for the first time and ran the script again:'
    Write-Host ' * Unpin all the tiles in the start menu'
    Write-Host ' * Settings > Privacy: switch off all the radio buttons through all menus on the left'
    Write-Host ' * Settings > Privacy > Feedback & diagnostics menu: select Never for Feedback frequency'
    Write-Host ' * Settings > Apps, click the Manage optional features link. Remove Contact Support, Internet Explorer 11, Microsoft Quick Assist, and Windows Media Player'
    Write-Host ' * Settings > System > Notifications & actions: switch off "Get notifications from apps and other senders"'
    Write-Host ' * Settings > System > Notifications & actions: switch off "Show me the Windows welcome experience..."'
    Write-Host ' * Settings > System > Shared experiences: switch off "Let me open apps on other devices..."'
    Write-Host ' * Settings > Update & security, click the Advanced options link. Tick "Give me updates for other Microsoft products when I update Windows."'
    Write-Host ' * Run Windows Update for the first time!'
    Write-Host '***'
  2. Sean Harvey revised this gist Jul 17, 2019. 1 changed file with 1 addition and 1 deletion.
    2 changes: 1 addition & 1 deletion cleanup-win10.ps1
    Original file line number Diff line number Diff line change
    @@ -1,7 +1,7 @@
    ##
    ## Windows 10 cleanup script.
    ## Remove dodgy tracking settings, unneeded services, all apps, and optional features that come with Windows 10. Make it more like Windows 7.
    ## WARNING: UNTESTED AND MAY NOT WORK ON ANY VERSION BEYOND WINDOWS 10 CREATORS UPDATE (Build 1703)!
    ## WARNING: UNTESTED AND MAY NOT WORK ON ANY VERSION BEYOND WINDOWS 10 CREATORS UPDATE (Version 1703)!
    ##
    ## Instructions
    ## 1. Start Windows 10 installation. At the first point you are asked for input during Windows 10 setup, hit Shift-F10. This gives you a command prompt.
  3. Sean Harvey revised this gist Jul 17, 2019. 1 changed file with 1 addition and 0 deletions.
    1 change: 1 addition & 0 deletions cleanup-win10.ps1
    Original file line number Diff line number Diff line change
    @@ -1,6 +1,7 @@
    ##
    ## Windows 10 cleanup script.
    ## Remove dodgy tracking settings, unneeded services, all apps, and optional features that come with Windows 10. Make it more like Windows 7.
    ## WARNING: UNTESTED AND MAY NOT WORK ON ANY VERSION BEYOND WINDOWS 10 CREATORS UPDATE (Build 1703)!
    ##
    ## Instructions
    ## 1. Start Windows 10 installation. At the first point you are asked for input during Windows 10 setup, hit Shift-F10. This gives you a command prompt.
  4. Sean Harvey revised this gist Jul 14, 2019. 1 changed file with 0 additions and 3 deletions.
    3 changes: 0 additions & 3 deletions cleanup-win10.ps1
    Original file line number Diff line number Diff line change
    @@ -76,9 +76,6 @@ Write-Host 'Disabling services...'
    $services = @(
    # See https://virtualfeller.com/2017/04/25/optimize-vdi-windows-10-services-original-anniversary-and-creator-updates/

    # CDPSvc doesn't seem to do anything useful, that I found. See note on CDPUserSvc further down the script
    'CDPSvc',

    # Connected User Experiences and Telemetry
    'DiagTrack',

  5. Sean Harvey revised this gist Jul 14, 2019. 1 changed file with 0 additions and 7 deletions.
    7 changes: 0 additions & 7 deletions cleanup-win10.ps1
    Original file line number Diff line number Diff line change
    @@ -156,13 +156,6 @@ foreach ($service in $services) {
    Set-Service $service -StartupType Disabled
    }

    # CDPUserSvc is a mysterious service that just seems to throws errors in the event viewer. I haven't seen any problems with it disabled.
    # See https://social.technet.microsoft.com/Forums/en-US/c165a54a-4a69-441c-94a7-b5712b54385d/what-is-the-cdpusersvc-for-?forum=win10itprogeneral
    # Note that the related service CDPSvc is also disabled in the above services loop. CDPUserSvc can't be disabled by Set-Service, due to a random
    # hash after the service name, but disabling via the registry is perfectly fine.
    Write-Host 'Disabling CDPUserSvc...'
    Set-ItemProperty -Path 'HKLM:\SYSTEM\CurrentControlSet\Services\CDPUserSvc' -Name 'Start' -Value '4'

    Write-Host 'Disabling hibernate...'
    powercfg -h off

  6. Sean Harvey revised this gist Jul 29, 2017. 1 changed file with 4 additions and 0 deletions.
    4 changes: 4 additions & 0 deletions cleanup-win10.ps1
    Original file line number Diff line number Diff line change
    @@ -98,6 +98,10 @@ $services = @(
    # Superfetch
    'SysMain',

    # http://www.csoonline.com/article/3106076/data-protection/disable-wpad-now-or-have-your-accounts-and-private-data-compromised.html
    'iphlpsvc',
    'WinHttpAutoProxySvc',

    # Black Viper 'Safe for DESKTOP' services.
    # See http://www.blackviper.com/service-configurations/black-vipers-windows-10-service-configurations/
    'tzautoupdate',
  7. Sean Harvey revised this gist Jul 15, 2017. 1 changed file with 0 additions and 3 deletions.
    3 changes: 0 additions & 3 deletions cleanup-win10.ps1
    Original file line number Diff line number Diff line change
    @@ -91,9 +91,6 @@ $services = @(
    # AllJoyn Router Service (IoT)
    'AJRouter',

    # Radio Management Service
    'RmSvc',

    # SSDP Discovery (UPnP)
    'SSDPSRV',
    'upnphost',
  8. Sean Harvey revised this gist Jul 13, 2017. 1 changed file with 25 additions and 3 deletions.
    28 changes: 25 additions & 3 deletions cleanup-win10.ps1
    Original file line number Diff line number Diff line change
    @@ -65,7 +65,7 @@ New-Item -Path 'HKLM:\SOFTWARE\Policies\Microsoft\Windows Defender\' -Name 'Spyn
    New-ItemProperty -Path 'HKLM:\SOFTWARE\Policies\Microsoft\Windows Defender\Spynet' -Name 'SpynetReporting' -PropertyType DWord -Value '0' -Force
    New-ItemProperty -Path 'HKLM:\SOFTWARE\Policies\Microsoft\Windows Defender\Spynet' -Name 'SubmitSamplesConsent' -PropertyType DWord -Value '2' -Force

    # Disables PeerCaching, so updates are downloaded from Microsoft instead of other computers on the internet.
    # Ensure updates are downloaded from Microsoft instead of other computers on the internet.
    New-Item -Path 'HKLM:\SOFTWARE\Policies\Microsoft\Windows\' -Name 'DeliveryOptimization'
    New-ItemProperty -Path 'HKLM:\SOFTWARE\Policies\Microsoft\Windows\DeliveryOptimization' -Name 'DODownloadMode' -PropertyType DWord -Value '0' -Force
    New-ItemProperty -Path 'HKLM:\SOFTWARE\Policies\Microsoft\Windows\DeliveryOptimization' -Name 'SystemSettingsDownloadMode' -PropertyType DWord -Value '0' -Force
    @@ -74,11 +74,33 @@ New-ItemProperty -Path 'HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\Delivery

    Write-Host 'Disabling services...'
    $services = @(
    # CDPSvc doesn't seem to do anything useful, that I found. See note on CDPUserSvc further down the script.
    # DiagTrack is a feedback and diagnostics service, known for tracking.
    # See https://virtualfeller.com/2017/04/25/optimize-vdi-windows-10-services-original-anniversary-and-creator-updates/

    # CDPSvc doesn't seem to do anything useful, that I found. See note on CDPUserSvc further down the script
    'CDPSvc',

    # Connected User Experiences and Telemetry
    'DiagTrack',

    # Data Usage service
    'DusmSvc',

    # Peer-to-peer updates
    'DoSvc',

    # AllJoyn Router Service (IoT)
    'AJRouter',

    # Radio Management Service
    'RmSvc',

    # SSDP Discovery (UPnP)
    'SSDPSRV',
    'upnphost',

    # Superfetch
    'SysMain',

    # Black Viper 'Safe for DESKTOP' services.
    # See http://www.blackviper.com/service-configurations/black-vipers-windows-10-service-configurations/
    'tzautoupdate',
  9. Sean Harvey revised this gist Jul 13, 2017. 1 changed file with 0 additions and 1 deletion.
    1 change: 0 additions & 1 deletion cleanup-win10.ps1
    Original file line number Diff line number Diff line change
    @@ -51,7 +51,6 @@ New-ItemProperty -Path 'HKLM:\SOFTWARE\Policies\Microsoft\Windows\Windows Search
    New-ItemProperty -Path 'HKLM:\SOFTWARE\Policies\Microsoft\Windows\Windows Search' -Name 'ConnectedSearchUseWeb' -PropertyType DWord -Value '0' -Force

    # Remove OneDrive, and stop it from showing in Explorer side menu.
    # If OneDrive is *still* hanging around, remove it in Settings > Apps > Programs and Features.
    C:\Windows\SysWOW64\OneDriveSetup.exe /uninstall
    Remove-Item -Path 'HKCR:\CLSID\{018D5C66-4533-4307-9B53-224DE2ED1FE6}' -Recurse
    Remove-Item -Path 'HKCR:\Wow6432Node\CLSID\{018D5C66-4533-4307-9B53-224DE2ED1FE6}' -Recurse
  10. Sean Harvey revised this gist Jul 13, 2017. 1 changed file with 1 addition and 1 deletion.
    2 changes: 1 addition & 1 deletion cleanup-win10.ps1
    Original file line number Diff line number Diff line change
    @@ -52,7 +52,7 @@ New-ItemProperty -Path 'HKLM:\SOFTWARE\Policies\Microsoft\Windows\Windows Search

    # Remove OneDrive, and stop it from showing in Explorer side menu.
    # If OneDrive is *still* hanging around, remove it in Settings > Apps > Programs and Features.
    %SystemRoot%\SysWOW64\OneDriveSetup.exe /uninstall
    C:\Windows\SysWOW64\OneDriveSetup.exe /uninstall
    Remove-Item -Path 'HKCR:\CLSID\{018D5C66-4533-4307-9B53-224DE2ED1FE6}' -Recurse
    Remove-Item -Path 'HKCR:\Wow6432Node\CLSID\{018D5C66-4533-4307-9B53-224DE2ED1FE6}' -Recurse

  11. Sean Harvey revised this gist Jul 13, 2017. 1 changed file with 0 additions and 2 deletions.
    2 changes: 0 additions & 2 deletions cleanup-win10.ps1
    Original file line number Diff line number Diff line change
    @@ -61,8 +61,6 @@ New-ItemProperty -Path 'HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer
    New-ItemProperty -Path 'HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\Policies\DataCollection' -Name 'AllowTelemetry' -PropertyType DWord -Value '0' -Force
    New-ItemProperty -Path 'HKLM:\SOFTWARE\Policies\Microsoft\Windows\DataCollection' -Name 'AllowTelemetry' -PropertyType DWord -Value '0' -Force

    New-ItemProperty -Path 'HKLM:\SYSTEM\CurrentControlSet\Control\Remote Assistance' -Name 'fAllowFullControl' -PropertyType DWord -Value '0' -Force

    # Disable Windows Defender submission of samples and reporting.
    New-Item -Path 'HKLM:\SOFTWARE\Policies\Microsoft\Windows Defender\' -Name 'Spynet'
    New-ItemProperty -Path 'HKLM:\SOFTWARE\Policies\Microsoft\Windows Defender\Spynet' -Name 'SpynetReporting' -PropertyType DWord -Value '0' -Force
  12. Sean Harvey revised this gist Jul 13, 2017. 1 changed file with 2 additions and 0 deletions.
    2 changes: 2 additions & 0 deletions cleanup-win10.ps1
    Original file line number Diff line number Diff line change
    @@ -53,6 +53,8 @@ New-ItemProperty -Path 'HKLM:\SOFTWARE\Policies\Microsoft\Windows\Windows Search
    # Remove OneDrive, and stop it from showing in Explorer side menu.
    # If OneDrive is *still* hanging around, remove it in Settings > Apps > Programs and Features.
    %SystemRoot%\SysWOW64\OneDriveSetup.exe /uninstall
    Remove-Item -Path 'HKCR:\CLSID\{018D5C66-4533-4307-9B53-224DE2ED1FE6}' -Recurse
    Remove-Item -Path 'HKCR:\Wow6432Node\CLSID\{018D5C66-4533-4307-9B53-224DE2ED1FE6}' -Recurse

    # Disable data collection and telemetry settings.
    New-ItemProperty -Path 'HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer' -Name 'SmartScreenEnabled' -PropertyType String -Value 'Off' -Force
  13. Sean Harvey revised this gist Jul 13, 2017. 1 changed file with 2 additions and 10 deletions.
    12 changes: 2 additions & 10 deletions cleanup-win10.ps1
    Original file line number Diff line number Diff line change
    @@ -51,16 +51,8 @@ New-ItemProperty -Path 'HKLM:\SOFTWARE\Policies\Microsoft\Windows\Windows Search
    New-ItemProperty -Path 'HKLM:\SOFTWARE\Policies\Microsoft\Windows\Windows Search' -Name 'ConnectedSearchUseWeb' -PropertyType DWord -Value '0' -Force

    # Remove OneDrive, and stop it from showing in Explorer side menu.
    # If OneDrive is *still* hanging around, remove it in Windows Settings > Apps > Programs and Features.
    C:\Windows\SysWOW64\OneDriveSetup.exe /uninstall
    Start-Sleep -s 10
    New-Item -Path 'HKLM:\SOFTWARE\Policies\Microsoft\Windows\' -Name 'Skydrive'
    New-ItemProperty -Path 'HKLM:\SOFTWARE\Policies\Microsoft\Windows\Skydrive' -Name 'DisableFileSync' -PropertyType DWord -Value '1' -Force
    New-ItemProperty -Path 'HKLM:\SOFTWARE\Policies\Microsoft\Windows\Skydrive' -Name 'DisableLibrariesDefaultSaveToSkyDrive' -PropertyType DWord -Value '1' -Force
    New-Item -Path 'HKCR:\CLSID\' -Name '{018D5C66-4533-4307-9B53-224DE2ED1FE6}'
    New-Item -Path 'HKCR:\Wow6432Node\CLSID\' -Name '{018D5C66-4533-4307-9B53-224DE2ED1FE6}'
    New-ItemProperty -Path 'HKCR:\CLSID\{018D5C66-4533-4307-9B53-224DE2ED1FE6}' -Name 'System.IsPinnedToNameSpaceTree' -PropertyType DWord -Value '0' -Force
    New-ItemProperty -Path 'HKCR:\Wow6432Node\CLSID\{018D5C66-4533-4307-9B53-224DE2ED1FE6}' -Name 'System.IsPinnedToNameSpaceTree' -PropertyType DWord -Value '0' -Force
    # If OneDrive is *still* hanging around, remove it in Settings > Apps > Programs and Features.
    %SystemRoot%\SysWOW64\OneDriveSetup.exe /uninstall

    # Disable data collection and telemetry settings.
    New-ItemProperty -Path 'HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer' -Name 'SmartScreenEnabled' -PropertyType String -Value 'Off' -Force
  14. Sean Harvey revised this gist Jul 13, 2017. 1 changed file with 0 additions and 2 deletions.
    2 changes: 0 additions & 2 deletions cleanup-win10.ps1
    Original file line number Diff line number Diff line change
    @@ -57,8 +57,6 @@ Start-Sleep -s 10
    New-Item -Path 'HKLM:\SOFTWARE\Policies\Microsoft\Windows\' -Name 'Skydrive'
    New-ItemProperty -Path 'HKLM:\SOFTWARE\Policies\Microsoft\Windows\Skydrive' -Name 'DisableFileSync' -PropertyType DWord -Value '1' -Force
    New-ItemProperty -Path 'HKLM:\SOFTWARE\Policies\Microsoft\Windows\Skydrive' -Name 'DisableLibrariesDefaultSaveToSkyDrive' -PropertyType DWord -Value '1' -Force
    Remove-Item -Path 'HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\FolderDescriptions\{A52BBA46-E9E1-435f-B3D9-28DAA648C0F6}' -Recurse
    Remove-Item -Path 'HKLM:\SOFTWARE\Wow6432Node\Microsoft\Windows\CurrentVersion\Explorer\FolderDescriptions\{A52BBA46-E9E1-435f-B3D9-28DAA648C0F6}' -Recurse
    New-Item -Path 'HKCR:\CLSID\' -Name '{018D5C66-4533-4307-9B53-224DE2ED1FE6}'
    New-Item -Path 'HKCR:\Wow6432Node\CLSID\' -Name '{018D5C66-4533-4307-9B53-224DE2ED1FE6}'
    New-ItemProperty -Path 'HKCR:\CLSID\{018D5C66-4533-4307-9B53-224DE2ED1FE6}' -Name 'System.IsPinnedToNameSpaceTree' -PropertyType DWord -Value '0' -Force
  15. Sean Harvey revised this gist Jul 10, 2017. 1 changed file with 7 additions and 4 deletions.
    11 changes: 7 additions & 4 deletions cleanup-win10.ps1
    Original file line number Diff line number Diff line change
    @@ -183,9 +183,12 @@ Write-Host ''
    Write-Host '***'
    Write-Host 'Things to do after you have logged in for the first time and ran the script again:'
    Write-Host ' * Unpin all the tiles in the start menu'
    Write-Host ' * Windows Settings > Privacy: untick all the radio buttons through all menus on the left'
    Write-Host ' * Windows Settings > Privacy in the Feedback & diagnostics menu: select Never for Feedback frequency'
    Write-Host ' * Windows Settings > Apps > Manage optional features: remove Contact Support, Internet Explorer 11, Microsoft Quick Assist, and Windows Media Player'
    Write-Host ' * Windows Settings > Update & security > Advanced options: tick "Give me updates for other Microsoft products when I update Windows."'
    Write-Host ' * Settings > Privacy: switch off all the radio buttons through all menus on the left'
    Write-Host ' * Settings > Privacy > Feedback & diagnostics menu: select Never for Feedback frequency'
    Write-Host ' * Settings > Apps, click the Manage optional features link. Remove Contact Support, Internet Explorer 11, Microsoft Quick Assist, and Windows Media Player'
    Write-Host ' * Settings > System > Notifications & actions: switch off "Get notifications from apps and other senders"'
    Write-Host ' * Settings > System > Notifications & actions: switch off "Show me the Windows welcome experience..."'
    Write-Host ' * Settings > System > Shared experiences: switch off "Let me open apps on other devices..."'
    Write-Host ' * Settings > Update & security, click the Advanced options link. Tick "Give me updates for other Microsoft products when I update Windows."'
    Write-Host ' * Run Windows Update for the first time!'
    Write-Host '***'
  16. Sean Harvey revised this gist Jul 10, 2017. 1 changed file with 2 additions and 2 deletions.
    4 changes: 2 additions & 2 deletions cleanup-win10.ps1
    Original file line number Diff line number Diff line change
    @@ -11,7 +11,7 @@
    ## powershell -ExectionPolicy Bypass cleanup-win10.ps1
    ## 4. Let it run through, you may see a few errors, this is normal
    ## 5. Reboot
    ## shutdown /r /f
    ## shutdown /r /t 0
    ## 6. Contine installation as normal
    ## 7. Once you login for the first time, run this script again (under Powershell as Administrator):
    ## powershell -ExectionPolicy Bypass cleanup-win10.ps1
    @@ -174,7 +174,7 @@ foreach ($feature in $features) {
    Disable-WindowsOptionalFeature -Online -FeatureName $feature -NoRestart
    }

    Write-Host 'Finished. Reboot system with: shutdown /r /f'
    Write-Host 'Finished. Reboot system with: shutdown /r /t 0'
    Write-Host ''
    Write-Host '***'
    Write-Host 'If you ran this script during installation, make sure to run it again after logging in for the first time!'
  17. Sean Harvey revised this gist Jul 10, 2017. 1 changed file with 1 addition and 0 deletions.
    1 change: 1 addition & 0 deletions cleanup-win10.ps1
    Original file line number Diff line number Diff line change
    @@ -80,6 +80,7 @@ New-ItemProperty -Path 'HKLM:\SOFTWARE\Policies\Microsoft\Windows Defender\Spyne
    New-Item -Path 'HKLM:\SOFTWARE\Policies\Microsoft\Windows\' -Name 'DeliveryOptimization'
    New-ItemProperty -Path 'HKLM:\SOFTWARE\Policies\Microsoft\Windows\DeliveryOptimization' -Name 'DODownloadMode' -PropertyType DWord -Value '0' -Force
    New-ItemProperty -Path 'HKLM:\SOFTWARE\Policies\Microsoft\Windows\DeliveryOptimization' -Name 'SystemSettingsDownloadMode' -PropertyType DWord -Value '0' -Force
    New-Item -Path 'HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\DeliveryOptimization\' -Name 'Config'
    New-ItemProperty -Path 'HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\DeliveryOptimization\Config' -Name 'DODownloadMode' -PropertyType DWord -Value '0' -Force

    Write-Host 'Disabling services...'
  18. Sean Harvey revised this gist Jul 10, 2017. 1 changed file with 1 addition and 1 deletion.
    2 changes: 1 addition & 1 deletion cleanup-win10.ps1
    Original file line number Diff line number Diff line change
    @@ -1,6 +1,6 @@
    ##
    ## Windows 10 cleanup script.
    ## Remove dodgy tracking settings, and all the apps, and optional features that come with Windows 10. Make it more like Windows 7.
    ## Remove dodgy tracking settings, unneeded services, all apps, and optional features that come with Windows 10. Make it more like Windows 7.
    ##
    ## Instructions
    ## 1. Start Windows 10 installation. At the first point you are asked for input during Windows 10 setup, hit Shift-F10. This gives you a command prompt.
  19. Sean Harvey revised this gist Jul 10, 2017. 1 changed file with 1 addition and 1 deletion.
    2 changes: 1 addition & 1 deletion cleanup-win10.ps1
    Original file line number Diff line number Diff line change
    @@ -9,7 +9,7 @@
    ## cd x:
    ## 3. Run the script
    ## powershell -ExectionPolicy Bypass cleanup-win10.ps1
    ## 4. Let it run through, you may see a few errors, don't worry about it
    ## 4. Let it run through, you may see a few errors, this is normal
    ## 5. Reboot
    ## shutdown /r /f
    ## 6. Contine installation as normal
  20. Sean Harvey revised this gist Jul 10, 2017. 1 changed file with 1 addition and 1 deletion.
    2 changes: 1 addition & 1 deletion cleanup-win10.ps1
    Original file line number Diff line number Diff line change
    @@ -180,7 +180,7 @@ Write-Host 'If you ran this script during installation, make sure to run it agai
    Write-Host '***'
    Write-Host ''
    Write-Host '***'
    Write-Host 'Things to do after you have logged in for the first time:'
    Write-Host 'Things to do after you have logged in for the first time and ran the script again:'
    Write-Host ' * Unpin all the tiles in the start menu'
    Write-Host ' * Windows Settings > Privacy: untick all the radio buttons through all menus on the left'
    Write-Host ' * Windows Settings > Privacy in the Feedback & diagnostics menu: select Never for Feedback frequency'
  21. Sean Harvey revised this gist Jul 10, 2017. 1 changed file with 1 addition and 1 deletion.
    2 changes: 1 addition & 1 deletion cleanup-win10.ps1
    Original file line number Diff line number Diff line change
    @@ -176,7 +176,7 @@ foreach ($feature in $features) {
    Write-Host 'Finished. Reboot system with: shutdown /r /f'
    Write-Host ''
    Write-Host '***'
    Write-Host 'If you ran this script during installation, make sure to run it again under your user!'
    Write-Host 'If you ran this script during installation, make sure to run it again after logging in for the first time!'
    Write-Host '***'
    Write-Host ''
    Write-Host '***'
  22. Sean Harvey created this gist Jul 10, 2017.
    190 changes: 190 additions & 0 deletions cleanup-win10.ps1
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,190 @@
    ##
    ## Windows 10 cleanup script.
    ## Remove dodgy tracking settings, and all the apps, and optional features that come with Windows 10. Make it more like Windows 7.
    ##
    ## Instructions
    ## 1. Start Windows 10 installation. At the first point you are asked for input during Windows 10 setup, hit Shift-F10. This gives you a command prompt.
    ## 2. Now mount a network volume, or insert a USB key with this script on it and change directory to it. e.g.
    ## net use x: \\mynetworkmount
    ## cd x:
    ## 3. Run the script
    ## powershell -ExectionPolicy Bypass cleanup-win10.ps1
    ## 4. Let it run through, you may see a few errors, don't worry about it
    ## 5. Reboot
    ## shutdown /r /f
    ## 6. Contine installation as normal
    ## 7. Once you login for the first time, run this script again (under Powershell as Administrator):
    ## powershell -ExectionPolicy Bypass cleanup-win10.ps1
    ## 8. Go through the "Things to do after" shown at the end of the script
    ## 9. Done!
    ##

    New-PSDrive -Name HKCR -PSProvider Registry -Root HKEY_CLASSES_ROOT

    Write-Host 'Updating registry settings...'

    # Disable some of the "new" features of Windows 10, such as forcibly installing apps you don't want, and the new annoying animation for first time login.
    New-Item -Path 'HKLM:\SOFTWARE\Policies\Microsoft\Windows\' -Name 'CloudContent'
    New-ItemProperty -Path 'HKLM:\SOFTWARE\Policies\Microsoft\Windows\CloudContent' -Name 'DisableWindowsConsumerFeatures' -PropertyType DWord -Value '1' -Force
    New-ItemProperty -Path 'HKLM:\SOFTWARE\Policies\Microsoft\Windows\CloudContent' -Name 'DisableSoftLanding' -PropertyType DWord -Value '1' -Force
    New-ItemProperty -Path 'HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\Policies\System' -Name 'EnableFirstLogonAnimation' -PropertyType DWord -Value '0' -Force

    # Set some commonly changed settings for the current user. The interesting one here is "NoTileApplicationNotification" which disables a bunch of start menu tiles.
    New-Item -Path 'HKCU:\Software\Policies\Microsoft\Windows\CurrentVersion\' -Name 'PushNotifications'
    New-ItemProperty -Path 'HKCU:\Software\Policies\Microsoft\Windows\CurrentVersion\PushNotifications' -Name 'NoTileApplicationNotification' -PropertyType DWord -Value '1' -Force
    New-Item -Path 'HKCU:\Software\Microsoft\Windows\CurrentVersion\Explorer\' -Name 'CabinetState'
    New-ItemProperty -Path 'HKCU:\Software\Microsoft\Windows\CurrentVersion\Explorer\CabinetState' -Name 'FullPath' -PropertyType DWord -Value '1' -Force
    New-ItemProperty -Path 'HKCU:\Software\Microsoft\Windows\CurrentVersion\Explorer\Advanced' -Name 'HideFileExt' -PropertyType DWord -Value '0' -Force
    New-ItemProperty -Path 'HKCU:\Software\Microsoft\Windows\CurrentVersion\Explorer\Advanced' -Name 'Hidden' -PropertyType DWord -Value '1' -Force
    New-ItemProperty -Path 'HKCU:\Software\Microsoft\Windows\CurrentVersion\Explorer\Advanced' -Name 'ShowSyncProviderNotifications' -PropertyType DWord -Value '0' -Force

    # Remove all Windows 10 apps, including Windows Store. You may not want this, but I don't ever use any of the apps or the start menu tiles.
    # This makes Windows 10 similar to Windows 7. Don't forget to unpin all the tiles after installation to trim down the start menu!
    Get-AppxProvisionedPackage -Online | Remove-AppxProvisionedPackage -Online
    Get-AppxPackage | Remove-AppxPackage

    # Disable Cortana, and disable any kind of web search or location settings.
    New-Item -Path 'HKLM:\SOFTWARE\Policies\Microsoft\Windows\' -Name 'Windows Search'
    New-ItemProperty -Path 'HKLM:\SOFTWARE\Policies\Microsoft\Windows\Windows Search' -Name 'AllowCortana' -PropertyType DWord -Value '0' -Force
    New-ItemProperty -Path 'HKLM:\SOFTWARE\Policies\Microsoft\Windows\Windows Search' -Name 'AllowSearchToUseLocation' -PropertyType DWord -Value '0' -Force
    New-ItemProperty -Path 'HKLM:\SOFTWARE\Policies\Microsoft\Windows\Windows Search' -Name 'DisableWebSearch' -PropertyType DWord -Value '1' -Force
    New-ItemProperty -Path 'HKLM:\SOFTWARE\Policies\Microsoft\Windows\Windows Search' -Name 'ConnectedSearchUseWeb' -PropertyType DWord -Value '0' -Force

    # Remove OneDrive, and stop it from showing in Explorer side menu.
    # If OneDrive is *still* hanging around, remove it in Windows Settings > Apps > Programs and Features.
    C:\Windows\SysWOW64\OneDriveSetup.exe /uninstall
    Start-Sleep -s 10
    New-Item -Path 'HKLM:\SOFTWARE\Policies\Microsoft\Windows\' -Name 'Skydrive'
    New-ItemProperty -Path 'HKLM:\SOFTWARE\Policies\Microsoft\Windows\Skydrive' -Name 'DisableFileSync' -PropertyType DWord -Value '1' -Force
    New-ItemProperty -Path 'HKLM:\SOFTWARE\Policies\Microsoft\Windows\Skydrive' -Name 'DisableLibrariesDefaultSaveToSkyDrive' -PropertyType DWord -Value '1' -Force
    Remove-Item -Path 'HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\FolderDescriptions\{A52BBA46-E9E1-435f-B3D9-28DAA648C0F6}' -Recurse
    Remove-Item -Path 'HKLM:\SOFTWARE\Wow6432Node\Microsoft\Windows\CurrentVersion\Explorer\FolderDescriptions\{A52BBA46-E9E1-435f-B3D9-28DAA648C0F6}' -Recurse
    New-Item -Path 'HKCR:\CLSID\' -Name '{018D5C66-4533-4307-9B53-224DE2ED1FE6}'
    New-Item -Path 'HKCR:\Wow6432Node\CLSID\' -Name '{018D5C66-4533-4307-9B53-224DE2ED1FE6}'
    New-ItemProperty -Path 'HKCR:\CLSID\{018D5C66-4533-4307-9B53-224DE2ED1FE6}' -Name 'System.IsPinnedToNameSpaceTree' -PropertyType DWord -Value '0' -Force
    New-ItemProperty -Path 'HKCR:\Wow6432Node\CLSID\{018D5C66-4533-4307-9B53-224DE2ED1FE6}' -Name 'System.IsPinnedToNameSpaceTree' -PropertyType DWord -Value '0' -Force

    # Disable data collection and telemetry settings.
    New-ItemProperty -Path 'HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer' -Name 'SmartScreenEnabled' -PropertyType String -Value 'Off' -Force
    New-ItemProperty -Path 'HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\Policies\DataCollection' -Name 'AllowTelemetry' -PropertyType DWord -Value '0' -Force
    New-ItemProperty -Path 'HKLM:\SOFTWARE\Policies\Microsoft\Windows\DataCollection' -Name 'AllowTelemetry' -PropertyType DWord -Value '0' -Force

    New-ItemProperty -Path 'HKLM:\SYSTEM\CurrentControlSet\Control\Remote Assistance' -Name 'fAllowFullControl' -PropertyType DWord -Value '0' -Force

    # Disable Windows Defender submission of samples and reporting.
    New-Item -Path 'HKLM:\SOFTWARE\Policies\Microsoft\Windows Defender\' -Name 'Spynet'
    New-ItemProperty -Path 'HKLM:\SOFTWARE\Policies\Microsoft\Windows Defender\Spynet' -Name 'SpynetReporting' -PropertyType DWord -Value '0' -Force
    New-ItemProperty -Path 'HKLM:\SOFTWARE\Policies\Microsoft\Windows Defender\Spynet' -Name 'SubmitSamplesConsent' -PropertyType DWord -Value '2' -Force

    # Disables PeerCaching, so updates are downloaded from Microsoft instead of other computers on the internet.
    New-Item -Path 'HKLM:\SOFTWARE\Policies\Microsoft\Windows\' -Name 'DeliveryOptimization'
    New-ItemProperty -Path 'HKLM:\SOFTWARE\Policies\Microsoft\Windows\DeliveryOptimization' -Name 'DODownloadMode' -PropertyType DWord -Value '0' -Force
    New-ItemProperty -Path 'HKLM:\SOFTWARE\Policies\Microsoft\Windows\DeliveryOptimization' -Name 'SystemSettingsDownloadMode' -PropertyType DWord -Value '0' -Force
    New-ItemProperty -Path 'HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\DeliveryOptimization\Config' -Name 'DODownloadMode' -PropertyType DWord -Value '0' -Force

    Write-Host 'Disabling services...'
    $services = @(
    # CDPSvc doesn't seem to do anything useful, that I found. See note on CDPUserSvc further down the script.
    # DiagTrack is a feedback and diagnostics service, known for tracking.
    'CDPSvc',
    'DiagTrack',

    # Black Viper 'Safe for DESKTOP' services.
    # See http://www.blackviper.com/service-configurations/black-vipers-windows-10-service-configurations/
    'tzautoupdate',
    'AppVClient',
    'RemoteRegistry',
    'RemoteAccess',
    'shpamsvc',
    'SCardSvr',
    'UevAgentService',
    'ALG',
    'PeerDistSvc',
    'NfsClnt',
    'dmwappushservice',
    'MapsBroker',
    'lfsvc',
    'HvHost',
    'vmickvpexchange',
    'vmicguestinterface',
    'vmicshutdown',
    'vmicheartbeat',
    'vmicvmsession',
    'vmicrdv',
    'vmictimesync',
    'vmicvss',
    'irmon',
    'SharedAccess',
    'MSiSCSI',
    'SmsRouter',
    'CscService',
    'SEMgrSvc',
    'PhoneSvc',
    'RpcLocator',
    'RetailDemo',
    'SensorDataService',
    'SensrSvc',
    'SensorService',
    'ScDeviceEnum',
    'SCPolicySvc',
    'SNMPTRAP',
    'TabletInputService',
    'WFDSConSvc',
    'FrameServer',
    'wisvc',
    'icssvc',
    'WinRM',
    'WwanSvc',
    'XblAuthManager',
    'XblGameSave',
    'XboxNetApiSvc'
    )
    foreach ($service in $services) {
    Set-Service $service -StartupType Disabled
    }

    # CDPUserSvc is a mysterious service that just seems to throws errors in the event viewer. I haven't seen any problems with it disabled.
    # See https://social.technet.microsoft.com/Forums/en-US/c165a54a-4a69-441c-94a7-b5712b54385d/what-is-the-cdpusersvc-for-?forum=win10itprogeneral
    # Note that the related service CDPSvc is also disabled in the above services loop. CDPUserSvc can't be disabled by Set-Service, due to a random
    # hash after the service name, but disabling via the registry is perfectly fine.
    Write-Host 'Disabling CDPUserSvc...'
    Set-ItemProperty -Path 'HKLM:\SYSTEM\CurrentControlSet\Services\CDPUserSvc' -Name 'Start' -Value '4'

    Write-Host 'Disabling hibernate...'
    powercfg -h off

    # Disables all of the known enabled-by-default optional features. There are some particulary bad defaults like SMB1. Sigh.
    Write-Host 'Disabling optional features...'
    $features = @(
    'MediaPlayback',
    'SMB1Protocol',
    'Xps-Foundation-Xps-Viewer',
    'WorkFolders-Client',
    'WCF-Services45',
    'NetFx4-AdvSrvs',
    'Printing-Foundation-Features',
    'Printing-PrintToPDFServices-Features',
    'Printing-XPSServices-Features',
    'MSRDC-Infrastructure',
    'MicrosoftWindowsPowerShellV2Root',
    'Internet-Explorer-Optional-amd64'
    )
    foreach ($feature in $features) {
    Disable-WindowsOptionalFeature -Online -FeatureName $feature -NoRestart
    }

    Write-Host 'Finished. Reboot system with: shutdown /r /f'
    Write-Host ''
    Write-Host '***'
    Write-Host 'If you ran this script during installation, make sure to run it again under your user!'
    Write-Host '***'
    Write-Host ''
    Write-Host '***'
    Write-Host 'Things to do after you have logged in for the first time:'
    Write-Host ' * Unpin all the tiles in the start menu'
    Write-Host ' * Windows Settings > Privacy: untick all the radio buttons through all menus on the left'
    Write-Host ' * Windows Settings > Privacy in the Feedback & diagnostics menu: select Never for Feedback frequency'
    Write-Host ' * Windows Settings > Apps > Manage optional features: remove Contact Support, Internet Explorer 11, Microsoft Quick Assist, and Windows Media Player'
    Write-Host ' * Windows Settings > Update & security > Advanced options: tick "Give me updates for other Microsoft products when I update Windows."'
    Write-Host ' * Run Windows Update for the first time!'
    Write-Host '***'