Skip to content

Instantly share code, notes, and snippets.

@Zhentar
Last active February 23, 2019 12:24
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Zhentar/8c377d7f43e1ffdf93cda141803c0fdd to your computer and use it in GitHub Desktop.
Save Zhentar/8c377d7f43e1ffdf93cda141803c0fdd to your computer and use it in GitHub Desktop.
Zhentar's Awesome Zero Dependency Windows Install Setup Scripts
function Set-ItemPropertyCreatePath {
Param(
[string]$Path,
[string]$Name,
[object]$Value,
$Type
)
If (!(Test-Path $Path)) {
New-Item -Path $Path -Force | Out-Null
}
if($PSBoundParameters.ContainsKey($Type)) {
Set-ItemProperty -Path $Path -Name $Name -Value $Value -Type $Type
} else {
Set-ItemProperty -Path $Path -Name $Name -Value $Value
}
}
# Because having all of the user folders pinned AND listed under This PC is a bit excessive
# Remove Desktop from This PC
Remove-Item -ErrorAction SilentlyContinue "HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\MyComputer\NameSpace\{B4BFCC3A-DB2C-424C-B029-7FE99A87C641}"
Remove-Item -ErrorAction SilentlyContinue "HKLM:\SOFTWARE\Wow6432Node\Microsoft\Windows\CurrentVersion\Explorer\MyComputer\NameSpace\{B4BFCC3A-DB2C-424C-B029-7FE99A87C641}"
# Remove Documents from This PC
Remove-Item -ErrorAction SilentlyContinue "HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\MyComputer\NameSpace\{A8CDFF1C-4878-43be-B5FD-F8091C1C60D0}"
Remove-Item -ErrorAction SilentlyContinue "HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\MyComputer\NameSpace\{d3162b92-9365-467a-956b-92703aca08af}"
Remove-Item -ErrorAction SilentlyContinue "HKLM:\SOFTWARE\Wow6432Node\Microsoft\Windows\CurrentVersion\Explorer\MyComputer\NameSpace\{A8CDFF1C-4878-43be-B5FD-F8091C1C60D0}"
Remove-Item -ErrorAction SilentlyContinue "HKLM:\SOFTWARE\Wow6432Node\Microsoft\Windows\CurrentVersion\Explorer\MyComputer\NameSpace\{d3162b92-9365-467a-956b-92703aca08af}"
# Remove Downloads from This PC
Remove-Item -ErrorAction SilentlyContinue "HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\MyComputer\NameSpace\{374DE290-123F-4565-9164-39C4925E467B}"
Remove-Item -ErrorAction SilentlyContinue "HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\MyComputer\NameSpace\{088e3905-0323-4b02-9826-5d99428e115f}"
Remove-Item -ErrorAction SilentlyContinue "HKLM:\SOFTWARE\Wow6432Node\Microsoft\Windows\CurrentVersion\Explorer\MyComputer\NameSpace\{374DE290-123F-4565-9164-39C4925E467B}"
Remove-Item -ErrorAction SilentlyContinue "HKLM:\SOFTWARE\Wow6432Node\Microsoft\Windows\CurrentVersion\Explorer\MyComputer\NameSpace\{088e3905-0323-4b02-9826-5d99428e115f}"
# Remove Music from This PC
Remove-Item -ErrorAction SilentlyContinue "HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\MyComputer\NameSpace\{1CF1260C-4DD0-4ebb-811F-33C572699FDE}"
Remove-Item -ErrorAction SilentlyContinue "HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\MyComputer\NameSpace\{3dfdf296-dbec-4fb4-81d1-6a3438bcf4de}"
Remove-Item -ErrorAction SilentlyContinue "HKLM:\SOFTWARE\Wow6432Node\Microsoft\Windows\CurrentVersion\Explorer\MyComputer\NameSpace\{1CF1260C-4DD0-4ebb-811F-33C572699FDE}"
Remove-Item -ErrorAction SilentlyContinue "HKLM:\SOFTWARE\Wow6432Node\Microsoft\Windows\CurrentVersion\Explorer\MyComputer\NameSpace\{3dfdf296-dbec-4fb4-81d1-6a3438bcf4de}"
# Remove Pictures from This PC
Remove-Item -ErrorAction SilentlyContinue "HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\MyComputer\NameSpace\{3ADD1653-EB32-4cb0-BBD7-DFA0ABB5ACCA}"
Remove-Item -ErrorAction SilentlyContinue "HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\MyComputer\NameSpace\{24ad3ad4-a569-4530-98e1-ab02f9417aa8}"
Remove-Item -ErrorAction SilentlyContinue "HKLM:\SOFTWARE\Wow6432Node\Microsoft\Windows\CurrentVersion\Explorer\MyComputer\NameSpace\{3ADD1653-EB32-4cb0-BBD7-DFA0ABB5ACCA}"
Remove-Item -ErrorAction SilentlyContinue "HKLM:\SOFTWARE\Wow6432Node\Microsoft\Windows\CurrentVersion\Explorer\MyComputer\NameSpace\{24ad3ad4-a569-4530-98e1-ab02f9417aa8}"
# Remove Videos from This PC
Remove-Item -ErrorAction SilentlyContinue "HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\MyComputer\NameSpace\{A0953C92-50DC-43bf-BE83-3742FED03C9C}"
Remove-Item -ErrorAction SilentlyContinue "HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\MyComputer\NameSpace\{f86fa3ab-70d2-4fc7-9c99-fcbf05467f3a}"
Remove-Item -ErrorAction SilentlyContinue "HKLM:\SOFTWARE\Wow6432Node\Microsoft\Windows\CurrentVersion\Explorer\MyComputer\NameSpace\{A0953C92-50DC-43bf-BE83-3742FED03C9C}"
Remove-Item -ErrorAction SilentlyContinue "HKLM:\SOFTWARE\Wow6432Node\Microsoft\Windows\CurrentVersion\Explorer\MyComputer\NameSpace\{f86fa3ab-70d2-4fc7-9c99-fcbf05467f3a}"
# Remove 3D Objects from This PC
Remove-Item -ErrorAction SilentlyContinue "HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\MyComputer\NameSpace\{0DB7E03F-FC29-4DC6-9020-FF41B59E513A}"
Remove-Item -ErrorAction SilentlyContinue "HKLM:\SOFTWARE\Wow6432Node\Microsoft\Windows\CurrentVersion\Explorer\MyComputer\NameSpace\{0DB7E03F-FC29-4DC6-9020-FF41B59E513A}"
Set-ItemPropertyCreatePath -Path HKLM:\SOFTWARE\Policies\Microsoft\Windows\Windows Search -Name "DisableWebSearch" -Type DWord -Value 1
#Turn off "Consumer Experience" (i.e. having forced promotional content such as F2P games in the start menu)
#Note that this only works for Enterprise & Education editions, because that's the consumer experience for you!
Set-ItemPropertyCreatePath -Path HKLM:\SOFTWARE\Policies\Microsoft\Windows\Cloud Content -Name DisableWindowsConsumerFeatures -Value 1
# WiFi Sense: HotSpot Sharing: Disable
Set-ItemPropertyCreatePath -Path HKLM:\Software\Microsoft\PolicyManager\default\WiFi\AllowWiFiHotSpotReporting -Name value -Type DWord -Value 0
# WiFi Sense: Shared HotSpot Auto-Connect: Disable
Set-ItemPropertyCreatePath -Path HKLM:\Software\Microsoft\PolicyManager\default\WiFi\AllowAutoConnectToWiFiSenseHotspots -Name value -Type DWord -Value 0
# Disable the Lock Screen (the one before password prompt - to prevent dropping the first character)
Set-ItemPropertyCreatePath -Path HKLM:\SOFTWARE\Policies\Microsoft\Windows\Personalization -Name NoLockScreen -Type DWord -Value 1
@( "Microsoft.BingFinance",
"Microsoft.3DBuilder",
"Microsoft.BingFinance",
"Microsoft.BingNews",
"Microsoft.BingSports",
"Microsoft.BingWeather",
"Microsoft.CommsPhone",
"Microsoft.Getstarted",
"Microsoft.WindowsMaps",
"Microsoft.GetHelp",
"Microsoft.Messaging",
"Microsoft.MicrosoftOfficeHub",
"Microsoft.OneConnect",
"Microsoft.WindowsPhone",
"Microsoft.WindowsSoundRecorder",
"Microsoft.MicrosoftStickyNotes",
"Microsoft.Office.Sway",
"Microsoft.XboxApp",
"Microsoft.XboxIdentityProvider",
"Microsoft.ZuneMusic",
"Microsoft.ZuneVideo",
"Microsoft.FreshPaint",
"Microsoft.Print3D",
"Microsoft.SkypeApp",
"Microsoft.Microsoft3DViewer",
"Microsoft.Whiteboard",
"microsoft.windowscommunicationsapps",
"Microsoft.People",
"Microsoft.MixedReality.Portal",
"Microsoft.WindowsAlarms",
"Microsoft.OfficeLens",
"Microsoft.YourPhone",
"Microsoft.ScreenSketch",
"Microsoft.MSPaint", #Paint 3D, not the one you could conceivably want
"*Autodesk*",
"*MarchofEmpires*",
"*BubbleWitch*",
"*Minecraft*",
"king.com*",
"*Twitter*",
"*.Duolingo-LearnLanguagesforFree",
"*.EclipseManager",
"ActiproSoftwareLLC.562882FEEB491", # Code Writer
"*.AdobePhotoshopExpress"
) | % { Get-AppxPackage -Name $_ -AllUsers | Remove-AppxPackage }
Get-Service -Name "WMPNetworkSvc" | Set-Service -StartupType Disabled
###############################################################################
### Windows Update & Application Updates #
###############################################################################
# Disable automatic reboot after install
Set-ItemPropertyCreatePath "HKLM:\Software\Policies\Microsoft\Windows\WindowsUpdate" "NoAutoRebootWithLoggedOnUsers" 1
Set-ItemPropertyCreatePath "HKLM:\Software\Policies\Microsoft\Windows\WindowsUpdate\AU" "NoAutoRebootWithLoggedOnUsers" 1
# Taskbar: Disable Cortana
Set-ItemPropertyCreatePath -Path "HKLM:\Software\Policies\Microsoft\Windows\Windows Search" -Name AllowCortana -Value 0
Set-ItemProperty -Path HKLM:\SOFTWARE\Policies\Microsoft\MicrosoftEdge -Name PreventFirstRunPage -Value 1
Set-ItemProperty -Path "HKLM:\SOFTWARE\Policies\Microsoft\Windows\Explorer" -Name "NoUseStoreOpenWith" -Type DWord -Value 1
Set-ItemProperty -Path "HKLM:\SOFTWARE\Policies\Microsoft\Windows\Explorer" -Name "NoNewAppAlert" -Type DWord -Value 1
Set-ItemProperty -Path "HKLM:\SOFTWARE\Policies\Microsoft\Windows\Explorer" -Name "HideRecentlyAddedApps" -Type DWord -Value 1
#Turn on numlock by default on boot
If (!(Test-Path "HKU:")) { New-PSDrive -Name HKU -PSProvider Registry -Root HKEY_USERS | Out-Null }
Set-ItemProperty -Path "HKU:\.DEFAULT\Control Panel\Keyboard" -Name "InitialKeyboardIndicators" -Type DWord -Value 2147483650
#Disables the OOBE "privacy experience" screen for new users
Set-ItemPropertyCreatePath -Path HKLM:\SOFTWARE\Policies\Microsoft\Windows\OOBE -Name DisablePrivacyExperience -Value 1
#Set up OneGet package manager manager, then Chocolatey package manager
Install-PackageProvider -Name NuGet -MinimumVersion 2.8.5.201 -Force
Set-PSRepository -Name PSGallery -InstallationPolicy Trusted
Install-PackageProvider ChocolateyGet
Import-PackageProvider ChocolateyGet
#basic starter installs
Install-Package -Force googlechrome
Install-Package -Force 7zip
Install-Package -Force notepadplusplus
Install-Package -Force windirstat
Install-Package -Force winmerge
#Install-Package -Force firefox
#Install-Package -Force winrar
#Install-Package -Force vlc
#Install-Package -Force winamp
#Install-Package -Force spotify
#Install-Package -Force keepass
#Install-Package -Force steam
#Install-Package -Force paint.net
#Install-Package -Force chocolateygui #UI for installing chocolatey packages
function Set-ItemPropertyCreatePath {
Param(
[string]$Path,
[string]$Name,
[object]$Value,
$Type
)
If (!(Test-Path $Path)) {
New-Item -Path $Path -Force | Out-Null
}
if($PSBoundParameters.ContainsKey($Type)) {
Set-ItemProperty -Path $Path -Name $Name -Value $Value -Type $Type
} else {
Set-ItemProperty -Path $Path -Name $Name -Value $Value
}
}
#https://github.com/Microsoft/windows-dev-box-setup-scripts/blob/master/scripts/FileExplorerSettings.ps1
#--- Configuring Windows properties ---
#--- Windows Features ---
# Show hidden files, Show protected OS files, Show file extensions
Set-ItemProperty -Path HKCU:\Software\Microsoft\Windows\CurrentVersion\Explorer\Advanced -Name Hidden -Type DWord -Value 1
Set-ItemProperty -Path HKCU:\Software\Microsoft\Windows\CurrentVersion\Explorer\Advanced -Name ShowSuperHidden -Type DWord -Value 1
Set-ItemProperty -Path HKCU:\Software\Microsoft\Windows\CurrentVersion\Explorer\Advanced -Name HideFileExt -Type DWord -Value 0
#--- File Explorer Settings ---
# will expand explorer to the actual folder you're in
Set-ItemProperty -Path HKCU:\Software\Microsoft\Windows\CurrentVersion\Explorer\Advanced -Name NavPaneExpandToCurrentFolder -Value 1
#adds things back in your left pane like recycle bin
Set-ItemProperty -Path HKCU:\Software\Microsoft\Windows\CurrentVersion\Explorer\Advanced -Name NavPaneShowAllFolders -Value 1
#opens PC to This PC, not quick access
Set-ItemProperty -Path HKCU:\Software\Microsoft\Windows\CurrentVersion\Explorer\Advanced -Name LaunchTo -Value 1
#taskbar where window is open for multi-monitor
Set-ItemProperty -Path HKCU:\Software\Microsoft\Windows\CurrentVersion\Explorer\Advanced -Name MMTaskbarMode -Value 2
# Disable Quick Access: Recent Files
#Set-ItemProperty -Path HKCU:\Software\Microsoft\Windows\CurrentVersion\Explorer -Name ShowRecent -Type DWord -Value 0
# Explorer: Avoid creating Thumbs.db files on network volumes
Set-ItemPropertyCreatePath -Path HKCU:\Software\Microsoft\Windows\CurrentVersion\Policies\Explorer -Name DisableThumbnailsOnNetworkFolders -Value 1
#Disable bing search in start menu
Set-ItemProperty -Path HKCU:\Software\Microsoft\Windows\CurrentVersion\Search -Name "BingSearchEnabled" -Type DWord -Value 0
Set-ItemProperty -Path HKCU:\Software\Microsoft\Windows\CurrentVersion\Search -Name "CortanaConsent" -Type DWord -Value 0
#Show GameBar tips on launching "games"
Set-ItemPropertyCreatePath -Path HKCU:\SOFTWARE\Microsoft\GameBar -Name "ShowStartupPanel" -Value 0
#Show taskbar labels (combine only when taskbar is full)"
Set-ItemProperty -Path HKCU:\Software\Microsoft\Windows\CurrentVersion\Explorer\Advanced -Name "TaskbarGlomLevel" -Type DWord -Value 1
Set-ItemProperty -Path HKCU:\Software\Microsoft\Windows\CurrentVersion\Explorer\Advanced -Name "MMTaskbarGlomLevel" -Type DWord -Value 1
# SysTray: Hide the Action Center, Network
Set-ItemPropertyCreatePath -Path HKCU:\Software\Microsoft\Windows\CurrentVersion\Policies\Explorer -Name HideSCAHealth -Value 1 # Action Center
Set-ItemPropertyCreatePath -Path HKCU:\Software\Microsoft\Windows\CurrentVersion\Policies\Explorer -Name HideSCANetwork -Value 1 # Network
# Start Menu: Disable Bing Search Results
Set-ItemPropertyCreatePath -Path HKCU:\SOFTWARE\Microsoft\Windows\CurrentVersion\Search -Name BingSearchEnabled -Type DWord -Value 0
# Turn off People in Taskbar
Set-ItemPropertyCreatePath -Path HKCU:\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\Advanced\People -Name PeopleBand -Type DWord -Value 0
Set-ItemPropertyCreatePath -Path HKCU:\Control Panel\Accessibility\StickyKeys -Name Flags -Value 506
Set-ItemPropertyCreatePath -Path HKCU:\Control Panel\Accessibility\Keyboard Response -Name Flags -Value 122
Set-ItemPropertyCreatePath -Path HKCU:\Control Panel\Accessibility\ToggleKeys -Name Flags -Value 58
###############################################################################
### Internet Explorer #
###############################################################################
# Set home page to `about:blank` for faster loading
Set-ItemProperty "HKCU:\Software\Microsoft\Internet Explorer\Main" "Start Page" "about:blank"
# Disable 'Default Browser' check: "yes" or "no"
Set-ItemProperty "HKCU:\SOFTWARE\Microsoft\Internet Explorer\Main" "Check_Associations" "no"
# Disable Password Caching [Disable Remember Password]
Set-ItemProperty "HKCU:\SOFTWARE\Microsoft\Windows\CurrentVersion\Internet Settings" "DisablePasswordCaching" 1
$edgePath = "HKCU:\SOFTWARE\Classes\Local Settings\Software\Microsoft\Windows\CurrentVersion\AppContainer\Storage\microsoft.microsoftedge_8wekyb3d8bbwe\MicrosoftEdge\Main"
Set-ItemProperty -Path $edgePath -Name "FormSuggest Passwords" -Value "no" #"no"!? wtf kind of bool value is this, Edge programmers!?
Set-ItemProperty -Path $edgePath -Name "AskToCloseAllTabs" -Value 0
Set-ItemProperty -Path $edgePath -Name "DisallowDefaultBrowserPrompt" -Value 0
#This probably is just for UWP or something, but whatever, why not set it?
#--- Enable developer mode on the system ---
Set-ItemProperty -Path HKLM:\Software\Microsoft\Windows\CurrentVersion\AppModelUnlock -Name AllowDevelopmentWithoutDevLicense -Value 1
Import-PackageProvider ChocolateyGet
#basic tool setup
Install-Package -Force vscode -ProviderName ChocolateyGet
Install-Package -Force git
#Install-Package -Force python2
#Install-Package -Force python2
#Install-Package -Force tortoisegit
#Install-Package -Force jetbrains-rider
Install-Package -Force visualstudio2017community
Install-Package -Force visualstudio2017-workload-manageddesktop
#Install-Package -Force visualstudio2017-workload-managedgame #unity
Install-Package -Force sysinternals
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment