Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
(In Progress) PowerShell Script I use to customize my machines in the same way for privacy, search, UI, etc.
##################
# Privacy Settings
##################
# Privacy: Let apps use my advertising ID: Disable
Set-ItemProperty -Path HKCU:\SOFTWARE\Microsoft\Windows\CurrentVersion\AdvertisingInfo -Name Enabled -Type DWord -Value 0
# To Restore:
#Set-ItemProperty -Path HKCU:\SOFTWARE\Microsoft\Windows\CurrentVersion\AdvertisingInfo -Name Enabled -Type DWord -Value 1
# Privacy: SmartScreen Filter for Store Apps: Disable
Set-ItemProperty -Path HKCU:\SOFTWARE\Microsoft\Windows\CurrentVersion\AppHost -Name EnableWebContentEvaluation -Type DWord -Value 0
# To Restore:
#Set-ItemProperty -Path HKCU:\SOFTWARE\Microsoft\Windows\CurrentVersion\AppHost -Name EnableWebContentEvaluation -Type DWord -Value 1
# WiFi Sense: HotSpot Sharing: Disable
Set-ItemProperty -Path HKLM:\Software\Microsoft\PolicyManager\default\WiFi\AllowWiFiHotSpotReporting -Name value -Type DWord -Value 0
# WiFi Sense: Shared HotSpot Auto-Connect: Disable
Set-ItemProperty -Path HKLM:\Software\Microsoft\PolicyManager\default\WiFi\AllowAutoConnectToWiFiSenseHotspots -Name value -Type DWord -Value 0
# Activity Tracking: Disable
@('EnableActivityFeed','PublishUserActivities','UploadUserActivities') |% { Set-ItemProperty -Path HKLM:\SOFTWARE\Policies\Microsoft\Windows\System -Name $_ -Type DWord -Value 0 }
# Start Menu: Disable Bing Search Results
Set-ItemProperty -Path HKCU:\SOFTWARE\Microsoft\Windows\CurrentVersion\Search -Name BingSearchEnabled -Type DWord -Value 0
# To Restore (Enabled):
# Set-ItemProperty -Path HKCU:\SOFTWARE\Microsoft\Windows\CurrentVersion\Search -Name BingSearchEnabled -Type DWord -Value 1
# Start Menu: Disale Cortana (Commented out by default - this is personal preference)
# TODO: Figure this out - need another VM to test, mine's already disabled via domain, etc.
# Disable Telemetry (requires a reboot to take effect)
Set-ItemProperty -Path HKLM:\SOFTWARE\Policies\Microsoft\Windows\DataCollection -Name AllowTelemetry -Type DWord -Value 0
Get-Service DiagTrack,Dmwappushservice | Stop-Service | Set-Service -StartupType Disabled
############################
# Personal Preferences on UI
############################
# Change Explorer home screen back to "This PC"
Set-ItemProperty -Path HKCU:\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\Advanced -Name LaunchTo -Type DWord -Value 1
# Change it back to "Quick Access" (Windows 10 default)
#Set-ItemProperty -Path HKCU:\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\Advanced -Name LaunchTo -Type DWord -Value 2
# These make "Quick Access" behave much closer to the old "Favorites"
# Disable Quick Access: Recent Files
Set-ItemProperty -Path HKCU:\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer -Name ShowRecent -Type DWord -Value 0
# Disable Quick Access: Frequent Folders
Set-ItemProperty -Path HKCU:\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer -Name ShowFrequent -Type DWord -Value 0
# To Restore:
#Set-ItemProperty -Path HKCU:\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer -Name ShowRecent -Type DWord -Value 1
#Set-ItemProperty -Path HKCU:\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer -Name ShowFrequent -Type DWord -Value 1
# Disable the Lock Screen (the one before password prompt - to prevent dropping the first character)
If (-Not (Test-Path HKLM:\SOFTWARE\Policies\Microsoft\Windows\Personalization)) {
New-Item -Path HKLM:\SOFTWARE\Policies\Microsoft\Windows -Name Personalization | Out-Null
}
Set-ItemProperty -Path HKLM:\SOFTWARE\Policies\Microsoft\Windows\Personalization -Name NoLockScreen -Type DWord -Value 1
# To Restore:
#Set-ItemProperty -Path HKLM:\SOFTWARE\Policies\Microsoft\Windows\Personalization -Name NoLockScreen -Type DWord -Value 1
# Use the Windows 7-8.1 Style Volume Mixer
If (-Not (Test-Path "HKLM:\SOFTWARE\Microsoft\Windows NT\CurrentVersion\MTCUVC")) {
New-Item -Path "HKLM:\SOFTWARE\Microsoft\Windows NT\CurrentVersion" -Name MTCUVC | Out-Null
}
Set-ItemProperty -Path "HKLM:\SOFTWARE\Microsoft\Windows NT\CurrentVersion\MTCUVC" -Name EnableMtcUvc -Type DWord -Value 0
# To Restore (Windows 10 Style Volume Control):
#Set-ItemProperty -Path "HKLM:\SOFTWARE\Microsoft\Windows NT\CurrentVersion\MTCUVC" -Name EnableMtcUvc -Type DWord -Value 1
# Dark Theme for Windows (commenting out by default because this one's probbly a minority want)
# Note: the title bar text and such is still black with low contrast, and needs additional tweaks (it'll probably be better in a future build)
#If (-Not (Test-Path HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\Themes\Personalize)) {
# New-Item -Path HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\Themes -Name Personalize | Out-Null
#}
#Set-ItemProperty -Path HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\Themes\Personalize -Name AppsUseLightTheme -Type DWord -Value 0
#Set-ItemProperty -Path HKCU:\SOFTWARE\Microsoft\Windows\CurrentVersion\Themes\Personalize -Name AppsUseLightTheme -Type DWord -Value 0
# To Restore (Light Theme):
#Set-ItemProperty -Path HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\Themes\Personalize -Name AppsUseLightTheme -Type DWord -Value 1
#Set-ItemProperty -Path HKCU:\SOFTWARE\Microsoft\Windows\CurrentVersion\Themes\Personalize -Name AppsUseLightTheme -Type DWord -Value 1
#################
# Windows Updates
#################
# Change Windows Updates to "Notify to schedule restart"
Set-ItemProperty -Path HKCU:\SOFTWARE\Microsoft\WindowsUpdate\UX\Settings -Name UxOption -Type DWord -Value 1
# To Restore (Automatic):
#Set-ItemProperty -Path HKCU:\SOFTWARE\Microsoft\WindowsUpdate\UX\Settings -Name UxOption -Type DWord -Value 0
# Disable P2P Update downlods outside of local network
Set-ItemProperty -Path HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\DeliveryOptimization\Config -Name DODownloadMode -Type DWord -Value 1
Set-ItemProperty -Path HKCU:\SOFTWARE\Microsoft\Windows\CurrentVersion\DeliveryOptimization -Name SystemSettingsDownloadMode -Type DWord -Value 3
# To restore (PCs on my local network and PCs on the internet)
#Set-ItemProperty -Path HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\DeliveryOptimization\Config -Name DODownloadMode -Type DWord -Value 3
#Set-ItemProperty -Path HKCU:\SOFTWARE\Microsoft\Windows\CurrentVersion\DeliveryOptimization -Name SystemSettingsDownloadMode -Type DWord -Value 1
# To disable P2P update downloads completely:
#Set-ItemProperty -Path HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\DeliveryOptimization\Config -Name DODownloadMode -Type DWord -Value 0
###############################
# Windows 10 Metro App Removals
# These start commented out so you choose
# Just remove the # (comment in PowerShell) on the ones you want to remove
###############################
# Be gone, heathen!
#Get-AppxPackage king.com.CandyCrushSaga | Remove-AppxPackage
# Bing Weather, News, Sports, and Finance (Money):
#Get-AppxPackage Microsoft.BingWeather | Remove-AppxPackage
#Get-AppxPackage Microsoft.BingNews | Remove-AppxPackage
#Get-AppxPackage Microsoft.BingSports | Remove-AppxPackage
#Get-AppxPackage Microsoft.BingFinance | Remove-AppxPackage
# Xbox:
#Get-AppxPackage Microsoft.XboxApp | Remove-AppxPackage
# Windows Phone Companion
#Get-AppxPackage Microsoft.WindowsPhone | Remove-AppxPackage
# Solitaire Collection
#Get-AppxPackage Microsoft.MicrosoftSolitaireCollection | Remove-AppxPackage
# People
#Get-AppxPackage Microsoft.People | Remove-AppxPackage
# Groove Music
#Get-AppxPackage Microsoft.ZuneMusic | Remove-AppxPackage
# Movies & TV
#Get-AppxPackage Microsoft.ZuneVideo | Remove-AppxPackage
# OneNote
#Get-AppxPackage Microsoft.Office.OneNote | Remove-AppxPackage
# Photos
#Get-AppxPackage Microsoft.Windows.Photos | Remove-AppxPackage
# Sound Recorder
#Get-AppxPackage Microsoft.WindowsSoundRecorder | Remove-AppxPackage
# Mail & Calendar
#Get-AppxPackage microsoft.windowscommunicationsapps | Remove-AppxPackage
# Skype (Metro version)
#Get-AppxPackage Microsoft.SkypeApp | Remove-AppxPackage
@HillbillyJones

This comment has been minimized.

Copy link

HillbillyJones commented Jan 10, 2016

Nice! 👍 Thanks for sharing. How did you discover the registry key values

@mikecasas

This comment has been minimized.

Copy link

mikecasas commented Jan 15, 2016

Very helpful, thanks.

@deedubb

This comment has been minimized.

Copy link

deedubb commented Mar 9, 2016

Nice work Nick! Thank you!

@freshW

This comment has been minimized.

Copy link

freshW commented May 31, 2016

Big Thanks @NickCraver for the nice Script.
for me missing is the old Windows Photoviewer, and i remove some other Packages... Here the Code. May you want to add something.

Remove SolitaireCollection

Get-AppxPackage solitairecollection | Remove-AppxPackage

Remove Office

Get-AppxPackage officehub | Remove-AppxPackage

Remove 3D Builder

Get-AppxPackage 3dbuilder | Remove-AppxPackage

Remove Windows Camera

Get-AppxPackage windowscamera | Remove-AppxPackage

Remove Get Started

Get-AppxPackage getstarted | Remove-AppxPackage

Remove Foto Viewer App.

Get-AppxPackage photo | Remove-AppxPackage


Add Old Windows Pictureviewer (Windows 7 Style)
__
Regfile

Windows Registry Editor Version 5.00

[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows Photo Viewer\Capabilities\FileAssociations]
".tif"="PhotoViewer.FileAssoc.Tiff"
".tiff"="PhotoViewer.FileAssoc.Tiff"
".jpg"="PhotoViewer.FileAssoc.Tiff"
".jpeg"="PhotoViewer.FileAssoc.Tiff"
".png"="PhotoViewer.FileAssoc.Tiff"
".gif"="PhotoViewer.FileAssoc.Tiff"
".bmp"="PhotoViewer.FileAssoc.Tiff"

@dezza

This comment has been minimized.

Copy link

dezza commented Jun 7, 2016

Get-AppxPackage | where {$_.name -Match "3dbuilder|windowsalarms|windowscommunicationapps|windowscamera|officehub|skypeapp|getstarted|zunemusic|windowsmaps|solitairecollection|bingfinance|zunevideo|bingnews|onenote|people|windowsphone|photos|windowsstore|bingsports|soundrecorder|bingweather|xboxapp"} | Remove-AppxPackage -ea 0

A single command for deleting all built-in apps :) Some of them will give an error so maybe a good idea is to add -ea 0 at the end to not report on non-existing apps (Maybe you already attempted to delete them)

And btw. On my system at least, these two keys were not present so I recommend to do the exists check on these as well:

L:5-6

# Privacy: Let apps use my advertising ID: Disable
If (-Not (Test-Path "HKCU:\SOFTWARE\Microsoft\Windows\CurrentVersion\AdvertisingInfo")) {
    New-Item -Path HKCU:\SOFTWARE\Microsoft\Windows\CurrentVersion\AdvertisingInfo | Out-Null
}

L:14-15

# WiFi Sense: HotSpot Sharing: Disable
If (-Not (Test-Path "HKLM:\Software\Microsoft\PolicyManager\default\WiFi\AllowWiFiHotSpotReporting")) {
    New-Item -Path HKLM:\Software\Microsoft\PolicyManager\default\WiFi\AllowWiFiHotSpotReporting | Out-Null
}
@khalisz

This comment has been minimized.

Copy link

khalisz commented Aug 11, 2016

Hi 👍

Thanks a lot! :)

@halkun

This comment has been minimized.

Copy link

halkun commented Jun 23, 2017

Love the "Disable Quick Access: Frequent Folders" and "Disable Quick Access: Recent Files". That was bugging me as I had to manually disable in the option. Glad there's automated way to disable them! :)

@malroy

This comment has been minimized.

Copy link

malroy commented Jul 4, 2017

Hi there,

I am wondering if your script work with windows 10 64bit ? do you need to add Wow6432Node ??

@GovGeek

This comment has been minimized.

Copy link

GovGeek commented Aug 11, 2017

Awesome, thanks!

@neil-cole

This comment has been minimized.

Copy link

neil-cole commented Sep 27, 2017

Be careful about removing "All" win 10 packages. This can disable the Windows Store feature which most users will need.

@wsmelton

This comment has been minimized.

Copy link

wsmelton commented Oct 25, 2017

I figured out the todo item

New-Item -Path 'HKLM:\SOFTWARE\Policies\Microsoft\Windows' -Name 'Windows Search' -ItemType Key
New-ItemProperty -Path 'HKLM:\SOFTWARE\Policies\Microsoft\Windows\Windows Search' -Name AllowCortana -Type DWORD -Value 0
@jenyayel

This comment has been minimized.

Copy link

jenyayel commented Apr 23, 2018

HKCU:\SOFTWARE\Microsoft\WindowsUpdate\UX\Settings\UxOption is under Local Machine, so should be HKLM:\SOFTWARE\Microsoft\WindowsUpdate\UX\Settings

@Brizio

This comment has been minimized.

Copy link

Brizio commented Feb 26, 2019

I figured out the todo item
New-Item -Path 'HKLM:\SOFTWARE\Policies\Microsoft\Windows' -Name 'Windows Search' -ItemType Key
New-ItemProperty -Path 'HKLM:\SOFTWARE\Policies\Microsoft\Windows\Windows Search' -Name AllowCortana -Type DWORD -Value 0

yeh this works after a reboot or the explorer.exe restart

@milanjaros

This comment has been minimized.

Copy link

milanjaros commented Mar 16, 2019

# Hide useless folders
gi "$Home\3D Objects",$Home\Contacts,$Home\Favorites,$Home\Links,"$Home\Saved Games",$Home\Searches -Force | foreach { $_.Attributes = $_.Attributes -bor "Hidden" }
# To Restore:
gi "$Home\3D Objects",$Home\Contacts,$Home\Favorites,$Home\Links,"$Home\Saved Games",$Home\Searches -Force | foreach { $_.Attributes = $_.Attributes -xor "Hidden" }
@milanjaros

This comment has been minimized.

Copy link

milanjaros commented Mar 16, 2019

# Uninstall OneDrive
if (Test-Path $env:SystemRoot\SysWOW64\) { & $env:SystemRoot\SysWOW64\OneDriveSetup.exe /uninstall } else { & $env:SystemRoot\System32\OneDriveSetup.exe /uninstall }
# To Restore:

# Uninstall OneDrive
if (Test-Path $env:SystemRoot\SysWOW64\) { & $env:SystemRoot\SysWOW64\OneDriveSetup.exe /install } else { & $env:SystemRoot\System32\OneDriveSetup.exe /install }
@simnether

This comment has been minimized.

Copy link

simnether commented Mar 19, 2019

#Remove CandyCrushFriends 
Get-AppxPackage king.com.CandyCrushFriends | Remove-AppxPackage
@neekdyako

This comment has been minimized.

Copy link

neekdyako commented May 9, 2019

#DISABLE All BLOATWARE EXCEPT STORE
Get-AppxPackage -AllUsers | where-object {$_.name –notlike "*store*"} | Remove-AppxPackage

Use that command to completely remove all pre-installed windows bloatware apps except the store (so that you can still install apps that you might need). :)

@Franck-E

This comment has been minimized.

Copy link

Franck-E commented Jun 24, 2019

Thanks Nick, this is pretty cool, and here are some more..


  • Power Options

  • Screen on AC to never sleep
    powercfg /change monitor-timeout-ac 0

  • PC on AC to never sleep
    powercfg /change standby-timeout-ac 0

  • Screen on Battery (Laptop Only)
    -powercfg /change monitor-timeout-dc 0

  • Sleep on Battery (Laptop Only)
    -powercfg /change standby-timeout-dc 0


  • Display Settings

  • Turn off "Show taskbar on all display"
    Set-ItemProperty -Path HKCU:\Software\Microsoft\Windows\CurrentVersion\Explorer\Advanced -Name MMTaskbarEnabled -Type DWord -Value 0

  • Restart Explorer
    Stop-Process -ProcessName explorer


  • IE Settings

  • Open PowerPoint within IE
    Set-ItemProperty -Path HKLM:\SOFTWARE\Classes\PowerPoint.Show.12 -Name BrowserFlags -Type DWord -Value 2147483808
    Set-ItemProperty -Path HKLM:\SOFTWARE\Classes\PowerPoint.ShowMacroEnabled.12 -Name BrowserFlags -Type DWord -Value 2147483808
    Set-ItemProperty -Path HKLM:\SOFTWARE\Classes\PowerPoint.SlideShow.12 -Name BrowserFlags -Type DWord -Value 2147483808
    Set-ItemProperty -Path HKLM:\SOFTWARE\Classes\PowerPoint.SlideShowMacroEnabled.12 -Name BrowserFlags -Type DWord -Value 2147483808

  • Open Excel within IE
    Set-ItemProperty -Path HKLM:\SOFTWARE\Classes\Excel.Sheet.12 -Name BrowserFlags -Type DWord -Value 2147486208
    Set-ItemProperty -Path HKLM:\SOFTWARE\Classes\Excel.SheetMacroEnabled.12 -Name BrowserFlags -Type DWord -Value 2147486208
    Set-ItemProperty -Path HKLM:\SOFTWARE\Classes\Excel.SheetBinaryMacroEnabled.12 -Name BrowserFlags -Type DWord -Value 2147486208

  • Open Word within IE
    Set-ItemProperty -Path HKLM:\SOFTWARE\Classes\Word.Document.12 -Name BrowserFlags -Type DWord -Value 2147483684
    Set-ItemProperty -Path HKLM:\SOFTWARE\Classes\Word.DocumentMacroEnabled.12 -Name BrowserFlags -Type DWord -Value 2147483684

  • Internet Explorer to open files automatically, and not ask to save them
    Set-ItemProperty -Path "HKCU:\Software\Microsoft\Windows\Shell\AttachmentExecute{0002DF01-0000-0000-C000-000000000046}" -Name PowerPoint.Show.12 -Type None -Value ([byte[]]@())
    Set-ItemProperty -Path "HKCU:\Software\Microsoft\Windows\Shell\AttachmentExecute{0002DF01-0000-0000-C000-000000000046}" -Name PowerPoint.SlideShow.12 -Type None -Value ([byte[]]@())
    Set-ItemProperty -Path "HKCU:\Software\Microsoft\Windows\Shell\AttachmentExecute{0002DF01-0000-0000-C000-000000000046}" -Name Excel.Sheet.12 -Type None -Value ([byte[]]@())
    Set-ItemProperty -Path "HKCU:\Software\Microsoft\Windows\Shell\AttachmentExecute{0002DF01-0000-0000-C000-000000000046}" -Name Word.Document.12 -Type None -Value ([byte[]]@())

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.