-
-
Save peter-avila/36f9ef0015884e2f625f4c4f6f76ab2a to your computer and use it in GitHub Desktop.
Boxstarter Windows 10 Configuration
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<# | |
The command to run, built from the raw link of this gist | |
Win+R | |
iexplore http://boxstarter.org/package/url?<RAW GIST LINK> | |
OR (if you don't like the way the web launcher force re-installs everything) | |
Create another script like the following to install and run the gist: | |
. { iwr -useb http://boxstarter.org/bootstrapper.ps1 } | iex; get-boxstarter -Force | |
install-boxstarterpackage -PackgeName <RAW GIST URL> | |
NOTES: | |
- This may need to be run a few times to get 100% to a finished state (though it should reboot and pick up where it left off) | |
- If you use windows hello or fingerprint scanning for authentication then just press enter 3x when | |
prompted for a password (and know that passwordless relogin will not work after a reboot) | |
- You will almost certainly want to modify the configuration and every other aspect of this script | |
to meet your own needs. | |
#> | |
# Boxstarter options | |
$Boxstarter.RebootOk=$false # Allow reboots? | |
$Boxstarter.NoPassword=$false # Is this a machine with no login password? | |
$Boxstarter.AutoLogin=$false # Save my password securely and auto-login after a reboot | |
# All of the configuration tasks that will be run. | |
$Configuration = @' | |
[ | |
"DisableWiFiSense", | |
"DisableWebSearch", | |
"DisableAppSuggestions", | |
"DisableBackgroundApps", | |
"DisableLockScreenSpotlight", | |
"DisableLocationTracking", | |
"DisableMapUpdates", | |
"DisableFeedback", | |
"DisableAdvertisingID", | |
"DisableCortana", | |
"DisableErrorReporting", | |
"SetP2PUpdateLocal", | |
"DisableAutoLogger", | |
"DisableDiagTrack", | |
"DisableWAPPush", | |
"DisableAdminShares", | |
"DisableSMB1", | |
"DisableNetDevicesAutoInst", | |
"DisableCtrldFolderAccess", | |
"DisableAutoplay", | |
"DisableAutorun", | |
"DisableSleepTimeout", | |
"DisableUpdateRestart", | |
"DisableHomeGroups", | |
"DisableSharedExperiences", | |
"DisableRemoteAssistance", | |
"DisableRemoteDesktop", | |
"DisableActionCenter", | |
"HideNetworkFromLockScreen", | |
"HideShutdownFromLockScreen", | |
"DisableStickyKeys", | |
"ShowTaskManagerDetails", | |
"ShowFileOperationsDetails", | |
"HideTaskbarSearchBox", | |
"ShowTaskView", | |
"HideTaskbarTitles", | |
"HideTaskbarPeopleIcon", | |
"DockTaskbarLeft", | |
"ShowTrayIcons", | |
"ShowKnownExtensions", | |
"ShowHiddenFiles", | |
"HideSyncNotifications", | |
"HideRecentShortcuts", | |
"SetExplorerThisPC", | |
"ShowThisPCOnDesktop", | |
"HideDocumentsFromExplorer", | |
"Hide3DObjectsFromThisPC", | |
"Hide3DObjectsFromExplorer", | |
"SetControlPanelViewIcons", | |
"SetVisualFXPerformance", | |
"UninstallMsftBloat", | |
"UninstallThirdPartyBloat", | |
"DisableXboxFeatures", | |
"DisableAdobeFlash", | |
"AddPhotoViewerOpenWith", | |
"DisableSearchAppInStore", | |
"DisableWiFiSense", | |
"DisableWebSearch", | |
"DisableAppSuggestions", | |
"DisableBackgroundApps", | |
"DisableLockScreenSpotlight", | |
"DisableLocationTracking", | |
"DisableMapUpdates", | |
"DisableFeedback", | |
"DisableAdvertisingID", | |
"DisableCortana", | |
"DisableErrorReporting", | |
"SetP2PUpdateLocal", | |
"DisableAutoLogger", | |
"DisableDiagTrack", | |
"DisableWAPPush", | |
"DisableAdminShares", | |
"DisableSMB1", | |
"DisableNetDevicesAutoInst", | |
"EnableCtrldFolderAccess", | |
"DisableUpdateRestart", | |
"EnableUpdateScheduleRestart", | |
"DisableRemoteAssistance", | |
"DisableRemoteDesktop", | |
"DisableAutoplay", | |
"DisableAutorun", | |
"DisableHomeGroups", | |
"DisableSharedExperiences", | |
"DisableActionCenter", | |
"DisableStickyKeys", | |
"ShowTaskManagerDetails", | |
"ShowFileOperationsDetails", | |
"SetControlPanelViewIcons", | |
"SetVisualFXAppearance", | |
"HideNetworkFromLockScreen", | |
"HideShutdownFromLockScreen", | |
"HideTaskbarSearchBox", | |
"HideTaskView", | |
"ShowSmallTaskbarIcons", | |
"HideTaskbarPeopleIcon", | |
"ShowTrayIcons", | |
"ShowKnownExtensions", | |
"ShowHiddenFiles", | |
"SetExplorerThisPC", | |
"HideDocumentsFromExplorer", | |
"Hide3DObjectsFromExplorer", | |
"HideSyncNotifications", | |
"HideRecentShortcuts", | |
"ShowThisPCOnDesktop", | |
"Hide3DObjectsFromThisPC", | |
"UninstallMsftBloat", | |
"UninstallThirdPartyBloat", | |
"DisableXboxFeatures", | |
"DisableAdobeFlash", | |
"SetPhotoViewerAssociation", | |
"AddPhotoViewerOpenWith", | |
"DisableSearchAppInStore", | |
"UnpinStartMenuTiles", | |
"RemoveDefaultPrinters", | |
"EnableAutoHideTaskbar" | |
] | |
'@ | |
# Downloads of non-chocolatey installed apps will go here (within system root) | |
$UtilDownloadPath = join-path $env:systemdrive 'Utilities\Downloads' | |
# Hahicorp manually installed apps go here and this gets added to your path | |
$UtilBinPath = join-path $env:systemdrive 'Utilities\bin' | |
# Add a folder to place your nefarious executables in so you can infect yourself (or run hacker tools like I do) | |
$BypassDefenderPaths = @('C:\_ByPassDefender') | |
# some manual installs: vscode-insiders and typora | |
$ManualDownloadInstall = @{ | |
'vscodeinsiders.exe' = 'https://go.microsoft.com/fwlink/?Linkid=852155' | |
# 'vscode.exe' = 'https://go.microsoft.com/fwlink/?linkid=852157' | |
'typora-setup-x64.exe' = 'https://typora.io/windows/typora-setup-x64.exe' | |
'skypeonlinepowershell.exe' = 'https://download.microsoft.com/download/2/0/5/2050B39B-4DA5-48E0-B768-583533B42C3B/SkypeOnlinePowershell.exe' | |
} | |
# Releases based github packages to download and install. I include Keeweb and the Hack font I love so dearly | |
$GithubReleasesPackages = @{ | |
'keeweb/keeweb' = "keeweb*win.x64.exe" | |
'source-foundry/Hack-windows-installer' = "HackWindowsInstaller.exe" | |
} | |
# Hashicorp packages | |
$HashicorpPackages = @('vagrant','terraform','vault') | |
# Change for whatever platform you want to download for | |
$HashicorpOS = 'windows' | |
# Architecture to download for (default is 64 bit) | |
$HashicorpArch = "amd64|x86_64" | |
# PowerShell Modules to install | |
$ModulesToBeInstalled = @( | |
'Azure', | |
'AzureAD', | |
'AzureADPreview', | |
'AzureRM', | |
'Configuration', | |
'CredentialManager', | |
'dbatools', | |
'EZOut', | |
'HistoryPx', | |
'InvokeBuild', | |
'PackageManagement', | |
'Pansies', | |
'platyPS', | |
'posh-git', | |
'PowerLine', | |
'PowerShellGet', | |
'powershell-yaml', | |
'psake', | |
'PSCodeHealth', | |
'PSDecode', | |
'PSDepend', | |
'PSGit', | |
'PSGraph', | |
'psmsgraph', | |
'PSScriptAnalyzer', | |
'SharePointPnPPowerShellOnline', | |
'SnippetPx', | |
'WinSCP', | |
'OhMyPsh' | |
) | |
# Chocolatey packages to install | |
$ChocoInstalls = @( | |
'7zip', | |
'7zip.commandline', | |
'cmder', | |
'curl', | |
'Cygwin', | |
'f.lux' | |
'dotnet4.7.1', | |
'dropbox', | |
'Firefox', | |
'foxitreader', | |
'git', | |
'git-credential-manager-for-windows', | |
'git-credential-winstore', | |
'gitextensions', | |
'GoogleChrome', | |
'sysinternals' | |
'hub', | |
'keypirinha', | |
'nano', | |
'nmap', | |
'notepadplusplus', | |
'nuget.commandline', | |
'paint.net', | |
'PDFCreator', | |
'procexp', | |
'putty', | |
'python', | |
'python3', | |
'rvtools', | |
'sharex', | |
'sql-server-management-studio', | |
'superputty', | |
'terminals', | |
'toolsroot', | |
'virtualbox', | |
'VirtualBox.ExtensionPack', | |
'VirtualCloneDrive', | |
'vlc', | |
'win32diskimager', | |
'windirstat', | |
'winscp', | |
'wireshark', | |
'yumi', | |
'visualstudiocode' | |
) | |
# Visual Studio Code extensions to install (both code-insiders and code if available) | |
$VSCodeExtensions = @( | |
'adamvoss.yaml', | |
'bierner.markdown-preview-github-styles', | |
'donjayamanne.githistory', | |
'DotJoshJohnson.xml', | |
'eriklynd.json-tools', | |
'formulahendry.azure-storage-explorer', | |
'ms-mssql.mssql', | |
'ms-python.python', | |
'ms-vscode.azure-account', | |
'ms-vscode.PowerShell', | |
'msazurermtools.azurerm-vscode-tools', | |
'robertohuertasm.vscode-icons', | |
'samcogan.arm-snippets', | |
'Shan.code-settings-sync' | |
) | |
# Chocolatey places a bunch of crap on the desktop after installing or updating software. This flag allows | |
# you to clean that up (Note: this will move *.lnk files from the Public user profile desktop and your own | |
# desktop to a new directory called 'shortcuts' on your desktop. This may or may not be what you want..) | |
$ClearDesktopShortcuts = $True | |
# Use the $MyPowerShellProfile to create a new powershell profile if one doesn't already exist | |
$CreatePowershellProfile = $TRUE | |
$MyPowerShellProfile = @' | |
## Detect if we are running powershell without a console. | |
$_ISCONSOLE = $TRUE | |
try { | |
[System.Console]::Clear() | |
} | |
catch { | |
$_ISCONSOLE = $FALSE | |
} | |
# Everything in this block is only relevant in a console. This keeps nonconsole based powershell sessions clean. | |
if ($_ISCONSOLE) { | |
## Check SHIFT state ASAP at startup so we can use that to control verbosity :) | |
try { | |
Add-Type -Assembly PresentationCore, WindowsBase | |
if ([System.Windows.Input.Keyboard]::IsKeyDown([System.Windows.Input.Key]::LeftShift) -or [System.Windows.Input.Keyboard]::IsKeyDown([System.Windows.Input.Key]::RightShift)) { | |
$VerbosePreference = "Continue" | |
} | |
} | |
catch { | |
# Maybe this is a non-windows host? | |
} | |
## Set the profile directory variable for possible use later | |
Set-Variable ProfileDir (Split-Path $MyInvocation.MyCommand.Path -Parent) -Scope Global -Option AllScope, Constant -ErrorAction SilentlyContinue | |
# Start OhMyPsh only if we are in a console | |
if ($Host.Name -eq 'ConsoleHost') { | |
if (Get-Module OhMyPsh -ListAvailable) { | |
Import-Module OhMyPsh | |
} | |
} | |
} | |
# Relax the code signing restriction so we can actually get work done | |
Import-module Microsoft.PowerShell.Security | |
Set-ExecutionPolicy RemoteSigned Process | |
'@ | |
# Install boxstarter (which installs chocolatey as well). | |
#Invoke-Expression ((New-Object System.Net.WebClient).DownloadString('http://boxstarter.org/bootstrapper.ps1')); get-boxstarter -Force | |
# Basic setup (Boxstarter stuff) | |
Update-ExecutionPolicy RemoteSigned | |
Enable-MicrosoftUpdate | |
#Set-CornerNavigationOptions -DisableUpperRightCornerShowCharms -DisableUpperLeftCornerSwitchApps -EnableUsePowerShellOnWinX | |
function Read-Choice { | |
Param( | |
[Parameter(Position = 0)] | |
[System.String]$Message, | |
[Parameter(Position = 1)] | |
[ValidateNotNullOrEmpty()] | |
[System.String[]]$Choices = @('&Yes', '&No', 'Yes to &All', 'No &to All'), | |
[Parameter(Position = 2)] | |
[System.Int32]$DefaultChoice = 0, | |
[Parameter(Position = 3)] | |
[System.String]$Title = [string]::Empty | |
) | |
[System.Management.Automation.Host.ChoiceDescription[]]$Poss = $Choices | ForEach-Object { | |
New-Object System.Management.Automation.Host.ChoiceDescription "$($_)", "Sets $_ as an answer." | |
} | |
$Host.UI.PromptForChoice( $Title, $Message, $Poss, $DefaultChoice ) | |
} | |
Function Get-SpecialPaths { | |
$SpecialFolders = @{} | |
$names = [Environment+SpecialFolder]::GetNames([Environment+SpecialFolder]) | |
foreach($name in $names) { | |
$SpecialFolders[$name] = [Environment]::GetFolderPath($name) | |
} | |
$SpecialFolders | |
} | |
Function Get-EnvironmentVariableNames { | |
param ( | |
[string]$Scope | |
) | |
([Environment]::GetEnvironmentVariables($Scope).GetEnumerator()).Name | |
} | |
Function Get-EnvironmentVariable { | |
param ( | |
[string]$Name, | |
[string]$Scope | |
) | |
[Environment]::GetEnvironmentVariable($Name, $Scope) | |
} | |
Function Update-SessionEnvironment { | |
<# | |
Ripped directly from the chocolatey project, used here just for initial setup | |
#> | |
$refreshEnv = $false | |
$invocation = $MyInvocation | |
if ($invocation.InvocationName -eq 'refreshenv') { | |
$refreshEnv = $true | |
} | |
if ($refreshEnv) { | |
Write-Output "Refreshing environment variables from the registry for powershell.exe. Please wait..." | |
} | |
else { | |
Write-Verbose "Refreshing environment variables from the registry." | |
} | |
$userName = $env:USERNAME | |
$architecture = $env:PROCESSOR_ARCHITECTURE | |
$psModulePath = $env:PSModulePath | |
#ordering is important here, $user comes after so we can override $machine | |
'Process', 'Machine', 'User' | | |
% { | |
$scope = $_ | |
Get-EnvironmentVariableNames -Scope $scope | | |
% { | |
Set-Item "Env:$($_)" -Value (Get-EnvironmentVariable -Scope $scope -Name $_) | |
} | |
} | |
#Path gets special treatment b/c it munges the two together | |
$paths = 'Machine', 'User' | | |
% { | |
(Get-EnvironmentVariable -Name 'PATH' -Scope $_) -split ';' | |
} | | |
Select -Unique | |
$Env:PATH = $paths -join ';' | |
# PSModulePath is almost always updated by process, so we want to preserve it. | |
$env:PSModulePath = $psModulePath | |
# reset user and architecture | |
if ($userName) { $env:USERNAME = $userName; } | |
if ($architecture) { $env:PROCESSOR_ARCHITECTURE = $architecture; } | |
if ($refreshEnv) { | |
Write-Output "Finished" | |
} | |
} | |
Function Add-EnvPath { | |
# Adds a path to the $ENV:Path list for a user or system if it does not already exist (in both the system and user Path variables) | |
param ( | |
[string]$Location, | |
[string]$NewPath | |
) | |
$AllPaths = $Env:Path -split ';' | |
if ($AllPaths -notcontains $NewPath) { | |
Write-Output "Adding Utilties bin directory path to the environmental path list: $UtilBinPath" | |
$NewPaths = (@(([Environment]::GetEnvironmentVariables($Location).GetEnumerator() | Where {$_.Name -eq 'Path'}).Value -split ';') + $UtilBinPath | Select-Object -Unique) -join ';' | |
[Environment]::SetEnvironmentVariable("PATH", $NewPaths, $Location) | |
} | |
} | |
function Start-Proc { | |
param([string]$Exe = $(Throw "An executable must be specified"), | |
[string]$Arguments, | |
[switch]$Hidden, | |
[switch]$waitforexit) | |
$startinfo = New-Object System.Diagnostics.ProcessStartInfo | |
$startinfo.FileName = $Exe | |
$startinfo.Arguments = $Arguments | |
if ($Hidden) { | |
$startinfo.WindowStyle = 'Hidden' | |
$startinfo.CreateNoWindow = $True | |
} | |
$process = [System.Diagnostics.Process]::Start($startinfo) | |
if ($waitforexit) { $process.WaitForExit() } | |
} | |
function Get-HashiCorpLatestVersion { | |
<# | |
function to find the most recent version in the json manifest | |
Note: We ignore anything not in strict x.x.x version format (betas and such) | |
#> | |
param( | |
$manifest, | |
$software | |
) | |
(($manifest.$software.versions | get-member -MemberType 'NoteProperty').Name | Where {$_ -match "^\d+\.\d+\.\d+$"} | ForEach-Object {[version]$_} | Sort-Object -Descending | Select-Object -First 1).ToString() | |
} | |
function Get-AllHashiCorpPackageLatestVersion { | |
<# | |
.SYNOPSIS | |
Retreives the most recent version of Hashicorp software packages from a json manifest | |
.DESCRIPTION | |
Retreives the most recent version of Hashicorp software packages from a json manifest | |
.PARAMETER manifest | |
JSON manifest data to search. | |
.EXAMPLE | |
Get-AllHashiCorpPackageLatestVersion | |
.NOTES | |
Author: Zachary Loeber | |
#> | |
param( | |
$manifest | |
) | |
$OutHash = @{} | |
$manifest | Get-Member -MemberType 'NoteProperty' | Foreach { | |
$OutHash.($_.Name) = Get-HashiCorpLatestVersion $manifest $_.Name | |
} | |
$OutHash | |
} | |
function Get-ChocoPackages { | |
if (get-command clist -ErrorAction:SilentlyContinue) { | |
clist -lo -r -all | Foreach { | |
$Name,$Version = $_ -split '\|' | |
New-Object -TypeName psobject -Property @{ | |
'Name' = $Name | |
'Version' = $Version | |
} | |
} | |
} | |
} | |
# Add a path for windows defender to bypass | |
function Add-DefenderBypassPath { | |
[CmdletBinding()] | |
param( | |
[Parameter(Mandatory=$true, ValueFromPipeline = $true)] | |
[string[]]$Path | |
) | |
begin { | |
$Paths = @() | |
} | |
process { | |
$Paths += $Path | |
} | |
end { | |
$Paths | Foreach-Object { | |
if (-not [string]::isnullorempty($_)) { | |
Add-MpPreference -ExclusionPath $_ -Force | |
} | |
} | |
} | |
} | |
# Disable Telemetry | |
Function DisableTelemetry { | |
Write-Host "Disabling Telemetry..." | |
Set-ItemProperty -Path "HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\Policies\DataCollection" -Name "AllowTelemetry" -Type DWord -Value 0 | |
Set-ItemProperty -Path "HKLM:\SOFTWARE\Policies\Microsoft\Windows\DataCollection" -Name "AllowTelemetry" -Type DWord -Value 0 | |
Set-ItemProperty -Path "HKLM:\SOFTWARE\Wow6432Node\Microsoft\Windows\CurrentVersion\Policies\DataCollection" -Name "AllowTelemetry" -Type DWord -Value 0 | |
Disable-ScheduledTask -TaskName "Microsoft\Windows\Application Experience\Microsoft Compatibility Appraiser" | Out-Null | |
Disable-ScheduledTask -TaskName "Microsoft\Windows\Application Experience\ProgramDataUpdater" | Out-Null | |
Disable-ScheduledTask -TaskName "Microsoft\Windows\Autochk\Proxy" | Out-Null | |
Disable-ScheduledTask -TaskName "Microsoft\Windows\Customer Experience Improvement Program\Consolidator" | Out-Null | |
Disable-ScheduledTask -TaskName "Microsoft\Windows\Customer Experience Improvement Program\UsbCeip" | Out-Null | |
Disable-ScheduledTask -TaskName "Microsoft\Windows\DiskDiagnostic\Microsoft-Windows-DiskDiagnosticDataCollector" | Out-Null | |
} | |
# Enable Telemetry | |
Function EnableTelemetry { | |
Write-Host "Enabling Telemetry..." | |
Set-ItemProperty -Path "HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\Policies\DataCollection" -Name "AllowTelemetry" -Type DWord -Value 3 | |
Set-ItemProperty -Path "HKLM:\SOFTWARE\Policies\Microsoft\Windows\DataCollection" -Name "AllowTelemetry" -Type DWord -Value 3 | |
Set-ItemProperty -Path "HKLM:\SOFTWARE\Wow6432Node\Microsoft\Windows\CurrentVersion\Policies\DataCollection" -Name "AllowTelemetry" -Type DWord -Value 3 | |
Enable-ScheduledTask -TaskName "Microsoft\Windows\Application Experience\Microsoft Compatibility Appraiser" | Out-Null | |
Enable-ScheduledTask -TaskName "Microsoft\Windows\Application Experience\ProgramDataUpdater" | Out-Null | |
Enable-ScheduledTask -TaskName "Microsoft\Windows\Autochk\Proxy" | Out-Null | |
Enable-ScheduledTask -TaskName "Microsoft\Windows\Customer Experience Improvement Program\Consolidator" | Out-Null | |
Enable-ScheduledTask -TaskName "Microsoft\Windows\Customer Experience Improvement Program\UsbCeip" | Out-Null | |
Enable-ScheduledTask -TaskName "Microsoft\Windows\DiskDiagnostic\Microsoft-Windows-DiskDiagnosticDataCollector" | Out-Null | |
} | |
# Disable Wi-Fi Sense | |
Function DisableWiFiSense { | |
Write-Host "Disabling Wi-Fi Sense..." | |
If (!(Test-Path "HKLM:\SOFTWARE\Microsoft\PolicyManager\default\WiFi\AllowWiFiHotSpotReporting")) { | |
New-Item -Path "HKLM:\SOFTWARE\Microsoft\PolicyManager\default\WiFi\AllowWiFiHotSpotReporting" -Force | Out-Null | |
} | |
Set-ItemProperty -Path "HKLM:\SOFTWARE\Microsoft\PolicyManager\default\WiFi\AllowWiFiHotSpotReporting" -Name "Value" -Type DWord -Value 0 | |
Set-ItemProperty -Path "HKLM:\SOFTWARE\Microsoft\PolicyManager\default\WiFi\AllowAutoConnectToWiFiSenseHotspots" -Name "Value" -Type DWord -Value 0 | |
If (!(Test-Path "HKLM:\SOFTWARE\Microsoft\WcmSvc\wifinetworkmanager\config")) { | |
New-Item -Path "HKLM:\SOFTWARE\Microsoft\WcmSvc\wifinetworkmanager\config" -Force | Out-Null | |
} | |
Set-ItemProperty -Path "HKLM:\SOFTWARE\Microsoft\WcmSvc\wifinetworkmanager\config" -Name "AutoConnectAllowedOEM" -Type Dword -Value 0 | |
Set-ItemProperty -Path "HKLM:\SOFTWARE\Microsoft\WcmSvc\wifinetworkmanager\config" -Name "WiFISenseAllowed" -Type Dword -Value 0 | |
} | |
# Enable Wi-Fi Sense | |
Function EnableWiFiSense { | |
Write-Host "Enabling Wi-Fi Sense..." | |
If (!(Test-Path "HKLM:\SOFTWARE\Microsoft\PolicyManager\default\WiFi\AllowWiFiHotSpotReporting")) { | |
New-Item -Path "HKLM:\SOFTWARE\Microsoft\PolicyManager\default\WiFi\AllowWiFiHotSpotReporting" -Force | Out-Null | |
} | |
Set-ItemProperty -Path "HKLM:\SOFTWARE\Microsoft\PolicyManager\default\WiFi\AllowWiFiHotSpotReporting" -Name "Value" -Type DWord -Value 1 | |
Set-ItemProperty -Path "HKLM:\SOFTWARE\Microsoft\PolicyManager\default\WiFi\AllowAutoConnectToWiFiSenseHotspots" -Name "Value" -Type DWord -Value 1 | |
Remove-ItemProperty -Path "HKLM:\SOFTWARE\Microsoft\WcmSvc\wifinetworkmanager\config" -Name "AutoConnectAllowedOEM" -ErrorAction SilentlyContinue | |
Remove-ItemProperty -Path "HKLM:\SOFTWARE\Microsoft\WcmSvc\wifinetworkmanager\config" -Name "WiFISenseAllowed" -ErrorAction SilentlyContinue | |
} | |
# Disable SmartScreen Filter | |
Function DisableSmartScreen { | |
Write-Host "Disabling SmartScreen Filter..." | |
Set-ItemProperty -Path "HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer" -Name "SmartScreenEnabled" -Type String -Value "Off" | |
Set-ItemProperty -Path "HKCU:\SOFTWARE\Microsoft\Windows\CurrentVersion\AppHost" -Name "EnableWebContentEvaluation" -Type DWord -Value 0 | |
$edge = (Get-AppxPackage -AllUsers "Microsoft.MicrosoftEdge").PackageFamilyName | |
If (!(Test-Path "HKCU:\SOFTWARE\Classes\Local Settings\Software\Microsoft\Windows\CurrentVersion\AppContainer\Storage\$edge\MicrosoftEdge\PhishingFilter")) { | |
New-Item -Path "HKCU:\SOFTWARE\Classes\Local Settings\Software\Microsoft\Windows\CurrentVersion\AppContainer\Storage\$edge\MicrosoftEdge\PhishingFilter" -Force | Out-Null | |
} | |
Set-ItemProperty -Path "HKCU:\SOFTWARE\Classes\Local Settings\Software\Microsoft\Windows\CurrentVersion\AppContainer\Storage\$edge\MicrosoftEdge\PhishingFilter" -Name "EnabledV9" -Type DWord -Value 0 | |
Set-ItemProperty -Path "HKCU:\SOFTWARE\Classes\Local Settings\Software\Microsoft\Windows\CurrentVersion\AppContainer\Storage\$edge\MicrosoftEdge\PhishingFilter" -Name "PreventOverride" -Type DWord -Value 0 | |
} | |
# Enable SmartScreen Filter | |
Function EnableSmartScreen { | |
Write-Host "Enabling SmartScreen Filter..." | |
Set-ItemProperty -Path "HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer" -Name "SmartScreenEnabled" -Type String -Value "RequireAdmin" | |
Remove-ItemProperty -Path "HKCU:\SOFTWARE\Microsoft\Windows\CurrentVersion\AppHost" -Name "EnableWebContentEvaluation" -ErrorAction SilentlyContinue | |
$edge = (Get-AppxPackage -AllUsers "Microsoft.MicrosoftEdge").PackageFamilyName | |
Remove-ItemProperty -Path "HKCU:\SOFTWARE\Classes\Local Settings\Software\Microsoft\Windows\CurrentVersion\AppContainer\Storage\$edge\MicrosoftEdge\PhishingFilter" -Name "EnabledV9" -ErrorAction SilentlyContinue | |
Remove-ItemProperty -Path "HKCU:\SOFTWARE\Classes\Local Settings\Software\Microsoft\Windows\CurrentVersion\AppContainer\Storage\$edge\MicrosoftEdge\PhishingFilter" -Name "PreventOverride" -ErrorAction SilentlyContinue | |
} | |
# Disable Web Search in Start Menu | |
Function DisableWebSearch { | |
Write-Host "Disabling Bing Search in Start Menu..." | |
Set-ItemProperty -Path "HKCU:\SOFTWARE\Microsoft\Windows\CurrentVersion\Search" -Name "BingSearchEnabled" -Type DWord -Value 0 | |
If (!(Test-Path "HKLM:\SOFTWARE\Policies\Microsoft\Windows\Windows Search")) { | |
New-Item -Path "HKLM:\SOFTWARE\Policies\Microsoft\Windows\Windows Search" -Force | Out-Null | |
} | |
Set-ItemProperty -Path "HKLM:\SOFTWARE\Policies\Microsoft\Windows\Windows Search" -Name "DisableWebSearch" -Type DWord -Value 1 | |
} | |
# Enable Web Search in Start Menu | |
Function EnableWebSearch { | |
Write-Host "Enabling Bing Search in Start Menu..." | |
Remove-ItemProperty -Path "HKCU:\SOFTWARE\Microsoft\Windows\CurrentVersion\Search" -Name "BingSearchEnabled" -ErrorAction SilentlyContinue | |
Remove-ItemProperty -Path "HKLM:\SOFTWARE\Policies\Microsoft\Windows\Windows Search" -Name "DisableWebSearch" -ErrorAction SilentlyContinue | |
} | |
# Disable Application suggestions and automatic installation | |
Function DisableAppSuggestions { | |
Write-Host "Disabling Application suggestions..." | |
Set-ItemProperty -Path "HKCU:\SOFTWARE\Microsoft\Windows\CurrentVersion\ContentDeliveryManager" -Name "ContentDeliveryAllowed" -Type DWord -Value 0 | |
Set-ItemProperty -Path "HKCU:\SOFTWARE\Microsoft\Windows\CurrentVersion\ContentDeliveryManager" -Name "OemPreInstalledAppsEnabled" -Type DWord -Value 0 | |
Set-ItemProperty -Path "HKCU:\SOFTWARE\Microsoft\Windows\CurrentVersion\ContentDeliveryManager" -Name "PreInstalledAppsEnabled" -Type DWord -Value 0 | |
Set-ItemProperty -Path "HKCU:\SOFTWARE\Microsoft\Windows\CurrentVersion\ContentDeliveryManager" -Name "PreInstalledAppsEverEnabled" -Type DWord -Value 0 | |
Set-ItemProperty -Path "HKCU:\SOFTWARE\Microsoft\Windows\CurrentVersion\ContentDeliveryManager" -Name "SilentInstalledAppsEnabled" -Type DWord -Value 0 | |
Set-ItemProperty -Path "HKCU:\SOFTWARE\Microsoft\Windows\CurrentVersion\ContentDeliveryManager" -Name "SubscribedContent-338389Enabled" -Type DWord -Value 0 | |
Set-ItemProperty -Path "HKCU:\SOFTWARE\Microsoft\Windows\CurrentVersion\ContentDeliveryManager" -Name "SystemPaneSuggestionsEnabled" -Type DWord -Value 0 | |
Set-ItemProperty -Path "HKCU:\SOFTWARE\Microsoft\Windows\CurrentVersion\ContentDeliveryManager" -Name "SubscribedContent-338388Enabled" -Type DWord -Value 0 | |
If (!(Test-Path "HKLM:\SOFTWARE\Policies\Microsoft\Windows\CloudContent")) { | |
New-Item -Path "HKLM:\SOFTWARE\Policies\Microsoft\Windows\CloudContent" -Force | Out-Null | |
} | |
Set-ItemProperty -Path "HKLM:\SOFTWARE\Policies\Microsoft\Windows\CloudContent" -Name "DisableWindowsConsumerFeatures" -Type DWord -Value 1 | |
} | |
# Enable Application suggestions and automatic installation | |
Function EnableAppSuggestions { | |
Write-Host "Enabling Application suggestions..." | |
Set-ItemProperty -Path "HKCU:\SOFTWARE\Microsoft\Windows\CurrentVersion\ContentDeliveryManager" -Name "ContentDeliveryAllowed" -Type DWord -Value 1 | |
Set-ItemProperty -Path "HKCU:\SOFTWARE\Microsoft\Windows\CurrentVersion\ContentDeliveryManager" -Name "OemPreInstalledAppsEnabled" -Type DWord -Value 1 | |
Set-ItemProperty -Path "HKCU:\SOFTWARE\Microsoft\Windows\CurrentVersion\ContentDeliveryManager" -Name "PreInstalledAppsEnabled" -Type DWord -Value 1 | |
Set-ItemProperty -Path "HKCU:\SOFTWARE\Microsoft\Windows\CurrentVersion\ContentDeliveryManager" -Name "PreInstalledAppsEverEnabled" -Type DWord -Value 1 | |
Set-ItemProperty -Path "HKCU:\SOFTWARE\Microsoft\Windows\CurrentVersion\ContentDeliveryManager" -Name "SilentInstalledAppsEnabled" -Type DWord -Value 1 | |
Set-ItemProperty -Path "HKCU:\SOFTWARE\Microsoft\Windows\CurrentVersion\ContentDeliveryManager" -Name "SubscribedContent-338389Enabled" -Type DWord -Value 1 | |
Set-ItemProperty -Path "HKCU:\SOFTWARE\Microsoft\Windows\CurrentVersion\ContentDeliveryManager" -Name "SystemPaneSuggestionsEnabled" -Type DWord -Value 1 | |
Remove-ItemProperty -Path "HKCU:\SOFTWARE\Microsoft\Windows\CurrentVersion\ContentDeliveryManager" -Name "SubscribedContent-338388Enabled" -ErrorAction SilentlyContinue | |
Remove-ItemProperty -Path "HKLM:\SOFTWARE\Policies\Microsoft\Windows\CloudContent" -Name "DisableWindowsConsumerFeatures" -ErrorAction SilentlyContinue | |
} | |
# Disable Background application access - ie. if apps can download or update when they aren't used - Cortana is excluded as its inclusion breaks start menu search | |
Function DisableBackgroundApps { | |
Write-Host "Disabling Background application access..." | |
Get-ChildItem -Path "HKCU:\Software\Microsoft\Windows\CurrentVersion\BackgroundAccessApplications" -Exclude "Microsoft.Windows.Cortana*" | ForEach { | |
Set-ItemProperty -Path $_.PsPath -Name "Disabled" -Type DWord -Value 1 | |
Set-ItemProperty -Path $_.PsPath -Name "DisabledByUser" -Type DWord -Value 1 | |
} | |
} | |
# Enable Background application access | |
Function EnableBackgroundApps { | |
Write-Host "Enabling Background application access..." | |
Get-ChildItem -Path "HKCU:\Software\Microsoft\Windows\CurrentVersion\BackgroundAccessApplications" | ForEach { | |
Remove-ItemProperty -Path $_.PsPath -Name "Disabled" -ErrorAction SilentlyContinue | |
Remove-ItemProperty -Path $_.PsPath -Name "DisabledByUser" -ErrorAction SilentlyContinue | |
} | |
} | |
# Disable Lock screen Spotlight - New backgrounds, tips, advertisements etc. | |
Function DisableLockScreenSpotlight { | |
Write-Host "Disabling Lock screen spotlight..." | |
Set-ItemProperty -Path "HKCU:\Software\Microsoft\Windows\CurrentVersion\ContentDeliveryManager" -Name "RotatingLockScreenEnabled" -Type DWord -Value 0 | |
Set-ItemProperty -Path "HKCU:\Software\Microsoft\Windows\CurrentVersion\ContentDeliveryManager" -Name "RotatingLockScreenOverlayEnabled" -Type DWord -Value 0 | |
Set-ItemProperty -Path "HKCU:\Software\Microsoft\Windows\CurrentVersion\ContentDeliveryManager" -Name "SubscribedContent-338387Enabled" -Type DWord -Value 0 | |
} | |
# Enable Lock screen Spotlight | |
Function EnableLockScreenSpotlight { | |
Write-Host "Disabling Lock screen spotlight..." | |
Set-ItemProperty -Path "HKCU:\Software\Microsoft\Windows\CurrentVersion\ContentDeliveryManager" -Name "RotatingLockScreenEnabled" -Type DWord -Value 1 | |
Set-ItemProperty -Path "HKCU:\Software\Microsoft\Windows\CurrentVersion\ContentDeliveryManager" -Name "RotatingLockScreenOverlayEnabled" -Type DWord -Value 1 | |
Remove-ItemProperty -Path "HKCU:\Software\Microsoft\Windows\CurrentVersion\ContentDeliveryManager" -Name "SubscribedContent-338387Enabled" -ErrorAction SilentlyContinue | |
} | |
# Disable Location Tracking | |
Function DisableLocationTracking { | |
Write-Host "Disabling Location Tracking..." | |
Set-ItemProperty -Path "HKLM:\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Sensor\Overrides\{BFA794E4-F964-4FDB-90F6-51056BFE4B44}" -Name "SensorPermissionState" -Type DWord -Value 0 | |
Set-ItemProperty -Path "HKLM:\SYSTEM\CurrentControlSet\Services\lfsvc\Service\Configuration" -Name "Status" -Type DWord -Value 0 | |
} | |
# Enable Location Tracking | |
Function EnableLocationTracking { | |
Write-Host "Enabling Location Tracking..." | |
Set-ItemProperty -Path "HKLM:\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Sensor\Overrides\{BFA794E4-F964-4FDB-90F6-51056BFE4B44}" -Name "SensorPermissionState" -Type DWord -Value 1 | |
Set-ItemProperty -Path "HKLM:\SYSTEM\CurrentControlSet\Services\lfsvc\Service\Configuration" -Name "Status" -Type DWord -Value 1 | |
} | |
# Disable automatic Maps updates | |
Function DisableMapUpdates { | |
Write-Host "Disabling automatic Maps updates..." | |
Set-ItemProperty -Path "HKLM:\SYSTEM\Maps" -Name "AutoUpdateEnabled" -Type DWord -Value 0 | |
} | |
# Enable automatic Maps updates | |
Function EnableMapUpdates { | |
Write-Host "Enable automatic Maps updates..." | |
Remove-ItemProperty -Path "HKLM:\SYSTEM\Maps" -Name "AutoUpdateEnabled" -ErrorAction SilentlyContinue | |
} | |
# Disable Feedback | |
Function DisableFeedback { | |
Write-Host "Disabling Feedback..." | |
If (!(Test-Path "HKCU:\SOFTWARE\Microsoft\Siuf\Rules")) { | |
New-Item -Path "HKCU:\SOFTWARE\Microsoft\Siuf\Rules" -Force | Out-Null | |
} | |
Set-ItemProperty -Path "HKCU:\SOFTWARE\Microsoft\Siuf\Rules" -Name "NumberOfSIUFInPeriod" -Type DWord -Value 0 | |
Disable-ScheduledTask -TaskName "Microsoft\Windows\Feedback\Siuf\DmClient" -ErrorAction SilentlyContinue | Out-Null | |
Disable-ScheduledTask -TaskName "Microsoft\Windows\Feedback\Siuf\DmClientOnScenarioDownload" -ErrorAction SilentlyContinue | Out-Null | |
} | |
# Enable Feedback | |
Function EnableFeedback { | |
Write-Host "Enabling Feedback..." | |
Remove-ItemProperty -Path "HKCU:\SOFTWARE\Microsoft\Siuf\Rules" -Name "NumberOfSIUFInPeriod" -ErrorAction SilentlyContinue | |
Enable-ScheduledTask -TaskName "Microsoft\Windows\Feedback\Siuf\DmClient" -ErrorAction SilentlyContinue | Out-Null | |
Enable-ScheduledTask -TaskName "Microsoft\Windows\Feedback\Siuf\DmClientOnScenarioDownload" -ErrorAction SilentlyContinue | Out-Null | |
} | |
# Disable Advertising ID | |
Function DisableAdvertisingID { | |
Write-Host "Disabling Advertising ID..." | |
If (!(Test-Path "HKCU:\SOFTWARE\Microsoft\Windows\CurrentVersion\AdvertisingInfo")) { | |
New-Item -Path "HKCU:\SOFTWARE\Microsoft\Windows\CurrentVersion\AdvertisingInfo" | Out-Null | |
} | |
Set-ItemProperty -Path "HKCU:\SOFTWARE\Microsoft\Windows\CurrentVersion\AdvertisingInfo" -Name "Enabled" -Type DWord -Value 0 | |
If (!(Test-Path "HKCU:\SOFTWARE\Microsoft\Windows\CurrentVersion\Privacy")) { | |
New-Item -Path "HKCU:\SOFTWARE\Microsoft\Windows\CurrentVersion\Privacy" | Out-Null | |
} | |
Set-ItemProperty -Path "HKCU:\SOFTWARE\Microsoft\Windows\CurrentVersion\Privacy" -Name "TailoredExperiencesWithDiagnosticDataEnabled" -Type DWord -Value 0 | |
} | |
# Enable Advertising ID | |
Function EnableAdvertisingID { | |
Write-Host "Enabling Advertising ID..." | |
Remove-ItemProperty -Path "HKCU:\SOFTWARE\Microsoft\Windows\CurrentVersion\AdvertisingInfo" -Name "Enabled" -ErrorAction SilentlyContinue | |
If (!(Test-Path "HKCU:\SOFTWARE\Microsoft\Windows\CurrentVersion\Privacy")) { | |
New-Item -Path "HKCU:\SOFTWARE\Microsoft\Windows\CurrentVersion\Privacy" | Out-Null | |
} | |
Set-ItemProperty -Path "HKCU:\SOFTWARE\Microsoft\Windows\CurrentVersion\Privacy" -Name "TailoredExperiencesWithDiagnosticDataEnabled" -Type DWord -Value 2 | |
} | |
# Disable Cortana | |
Function DisableCortana { | |
Write-Host "Disabling Cortana..." | |
If (!(Test-Path "HKCU:\SOFTWARE\Microsoft\Personalization\Settings")) { | |
New-Item -Path "HKCU:\SOFTWARE\Microsoft\Personalization\Settings" -Force | Out-Null | |
} | |
Set-ItemProperty -Path "HKCU:\SOFTWARE\Microsoft\Personalization\Settings" -Name "AcceptedPrivacyPolicy" -Type DWord -Value 0 | |
If (!(Test-Path "HKCU:\SOFTWARE\Microsoft\InputPersonalization")) { | |
New-Item -Path "HKCU:\SOFTWARE\Microsoft\InputPersonalization" -Force | Out-Null | |
} | |
Set-ItemProperty -Path "HKCU:\SOFTWARE\Microsoft\InputPersonalization" -Name "RestrictImplicitTextCollection" -Type DWord -Value 1 | |
Set-ItemProperty -Path "HKCU:\SOFTWARE\Microsoft\InputPersonalization" -Name "RestrictImplicitInkCollection" -Type DWord -Value 1 | |
If (!(Test-Path "HKCU:\SOFTWARE\Microsoft\InputPersonalization\TrainedDataStore")) { | |
New-Item -Path "HKCU:\SOFTWARE\Microsoft\InputPersonalization\TrainedDataStore" -Force | Out-Null | |
} | |
Set-ItemProperty -Path "HKCU:\SOFTWARE\Microsoft\InputPersonalization\TrainedDataStore" -Name "HarvestContacts" -Type DWord -Value 0 | |
If (!(Test-Path "HKLM:\SOFTWARE\Policies\Microsoft\Windows\Windows Search")) { | |
New-Item -Path "HKLM:\SOFTWARE\Policies\Microsoft\Windows\Windows Search" -Force | Out-Null | |
} | |
Set-ItemProperty -Path "HKLM:\SOFTWARE\Policies\Microsoft\Windows\Windows Search" -Name "AllowCortana" -Type DWord -Value 0 | |
} | |
# Enable Cortana | |
Function EnableCortana { | |
Write-Host "Enabling Cortana..." | |
Remove-ItemProperty -Path "HKCU:\SOFTWARE\Microsoft\Personalization\Settings" -Name "AcceptedPrivacyPolicy" -ErrorAction SilentlyContinue | |
If (!(Test-Path "HKCU:\SOFTWARE\Microsoft\InputPersonalization\TrainedDataStore")) { | |
New-Item -Path "HKCU:\SOFTWARE\Microsoft\InputPersonalization\TrainedDataStore" -Force | Out-Null | |
} | |
Set-ItemProperty -Path "HKCU:\SOFTWARE\Microsoft\InputPersonalization" -Name "RestrictImplicitTextCollection" -Type DWord -Value 0 | |
Set-ItemProperty -Path "HKCU:\SOFTWARE\Microsoft\InputPersonalization" -Name "RestrictImplicitInkCollection" -Type DWord -Value 0 | |
Remove-ItemProperty -Path "HKCU:\SOFTWARE\Microsoft\InputPersonalization\TrainedDataStore" -Name "HarvestContacts" -ErrorAction SilentlyContinue | |
Remove-ItemProperty -Path "HKLM:\SOFTWARE\Policies\Microsoft\Windows\Windows Search" -Name "AllowCortana" -ErrorAction SilentlyContinue | |
} | |
# Disable Error reporting | |
Function DisableErrorReporting { | |
Write-Host "Disabling Error reporting..." | |
Set-ItemProperty -Path "HKLM:\SOFTWARE\Microsoft\Windows\Windows Error Reporting" -Name "Disabled" -Type DWord -Value 1 | |
Disable-ScheduledTask -TaskName "Microsoft\Windows\Windows Error Reporting\QueueReporting" | Out-Null | |
} | |
# Enable Error reporting | |
Function EnableErrorReporting { | |
Write-Host "Enabling Error reporting..." | |
Remove-ItemProperty -Path "HKLM:\SOFTWARE\Microsoft\Windows\Windows Error Reporting" -Name "Disabled" -ErrorAction SilentlyContinue | |
Enable-ScheduledTask -TaskName "Microsoft\Windows\Windows Error Reporting\QueueReporting" | Out-Null | |
} | |
# Restrict Windows Update P2P only to local network | |
Function SetP2PUpdateLocal { | |
Write-Host "Restricting Windows Update P2P only to local network..." | |
If (!(Test-Path "HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\DeliveryOptimization\Config")) { | |
New-Item -Path "HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\DeliveryOptimization\Config" | Out-Null | |
} | |
Set-ItemProperty -Path "HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\DeliveryOptimization\Config" -Name "DODownloadMode" -Type DWord -Value 1 | |
If (!(Test-Path "HKCU:\SOFTWARE\Microsoft\Windows\CurrentVersion\DeliveryOptimization")) { | |
New-Item -Path "HKCU:\SOFTWARE\Microsoft\Windows\CurrentVersion\DeliveryOptimization" | Out-Null | |
} | |
Set-ItemProperty -Path "HKCU:\SOFTWARE\Microsoft\Windows\CurrentVersion\DeliveryOptimization" -Name "SystemSettingsDownloadMode" -Type DWord -Value 3 | |
} | |
# Unrestrict Windows Update P2P | |
Function SetP2PUpdateInternet { | |
Write-Host "Unrestricting Windows Update P2P to internet..." | |
Remove-ItemProperty -Path "HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\DeliveryOptimization\Config" -Name "DODownloadMode" -ErrorAction SilentlyContinue | |
Remove-ItemProperty -Path "HKCU:\SOFTWARE\Microsoft\Windows\CurrentVersion\DeliveryOptimization" -Name "SystemSettingsDownloadMode" -ErrorAction SilentlyContinue | |
} | |
# Remove AutoLogger file and restrict directory | |
Function DisableAutoLogger { | |
Write-Host "Removing AutoLogger file and restricting directory..." | |
$autoLoggerDir = "$env:PROGRAMDATA\Microsoft\Diagnosis\ETLLogs\AutoLogger" | |
If (Test-Path "$autoLoggerDir\AutoLogger-Diagtrack-Listener.etl") { | |
Remove-Item -Path "$autoLoggerDir\AutoLogger-Diagtrack-Listener.etl" | |
} | |
icacls $autoLoggerDir /deny SYSTEM:`(OI`)`(CI`)F | Out-Null | |
} | |
# Unrestrict AutoLogger directory | |
Function EnableAutoLogger { | |
Write-Host "Unrestricting AutoLogger directory..." | |
$autoLoggerDir = "$env:PROGRAMDATA\Microsoft\Diagnosis\ETLLogs\AutoLogger" | |
icacls $autoLoggerDir /grant:r SYSTEM:`(OI`)`(CI`)F | Out-Null | |
} | |
# Stop and disable Diagnostics Tracking Service | |
Function DisableDiagTrack { | |
Write-Host "Stopping and disabling Diagnostics Tracking Service..." | |
Stop-Service "DiagTrack" -WarningAction SilentlyContinue | |
Set-Service "DiagTrack" -StartupType Disabled | |
} | |
# Enable and start Diagnostics Tracking Service | |
Function EnableDiagTrack { | |
Write-Host "Enabling and starting Diagnostics Tracking Service..." | |
Set-Service "DiagTrack" -StartupType Automatic | |
Start-Service "DiagTrack" -WarningAction SilentlyContinue | |
} | |
# Stop and disable WAP Push Service | |
Function DisableWAPPush { | |
Write-Host "Stopping and disabling WAP Push Service..." | |
Stop-Service "dmwappushservice" -WarningAction SilentlyContinue | |
Set-Service "dmwappushservice" -StartupType Disabled | |
} | |
# Enable and start WAP Push Service | |
Function EnableWAPPush { | |
Write-Host "Enabling and starting WAP Push Service..." | |
Set-Service "dmwappushservice" -StartupType Automatic | |
Start-Service "dmwappushservice" -WarningAction SilentlyContinue | |
Set-ItemProperty -Path "HKLM:\SYSTEM\CurrentControlSet\Services\dmwappushservice" -Name "DelayedAutoStart" -Type DWord -Value 1 | |
} | |
########## | |
# Service Tweaks | |
########## | |
# Lower UAC level (disabling it completely would break apps) | |
Function SetUACLow { | |
Write-Host "Lowering UAC level..." | |
Set-ItemProperty -Path "HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\Policies\System" -Name "ConsentPromptBehaviorAdmin" -Type DWord -Value 0 | |
Set-ItemProperty -Path "HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\Policies\System" -Name "PromptOnSecureDesktop" -Type DWord -Value 0 | |
} | |
# Raise UAC level | |
Function SetUACHigh { | |
Write-Host "Raising UAC level..." | |
Set-ItemProperty -Path "HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\Policies\System" -Name "ConsentPromptBehaviorAdmin" -Type DWord -Value 5 | |
Set-ItemProperty -Path "HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\Policies\System" -Name "PromptOnSecureDesktop" -Type DWord -Value 1 | |
} | |
# Enable sharing mapped drives between users | |
Function EnableSharingMappedDrives { | |
Write-Host "Enabling sharing mapped drives between users..." | |
Set-ItemProperty -Path "HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\Policies\System" -Name "EnableLinkedConnections" -Type DWord -Value 1 | |
} | |
# Disable sharing mapped drives between users | |
Function DisableSharingMappedDrives { | |
Write-Host "Disabling sharing mapped drives between users..." | |
Remove-ItemProperty -Path "HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\Policies\System" -Name "EnableLinkedConnections" -ErrorAction SilentlyContinue | |
} | |
# Disable implicit administrative shares | |
Function DisableAdminShares { | |
Write-Host "Disabling implicit administrative shares..." | |
Set-ItemProperty -Path "HKLM:\SYSTEM\CurrentControlSet\Services\LanmanServer\Parameters" -Name "AutoShareWks" -Type DWord -Value 0 | |
} | |
# Enable implicit administrative shares | |
Function EnableAdminShares { | |
Write-Host "Enabling implicit administrative shares..." | |
Remove-ItemProperty -Path "HKLM:\SYSTEM\CurrentControlSet\Services\LanmanServer\Parameters" -Name "AutoShareWks" -ErrorAction SilentlyContinue | |
} | |
# Disable obsolete SMB 1.0 protocol - Disabled by default since 1709 | |
Function DisableSMB1 { | |
Write-Host "Disabling SMB 1.0 protocol..." | |
Set-SmbServerConfiguration -EnableSMB1Protocol $false -Force | |
} | |
# Enable obsolete SMB 1.0 protocol - Disabled by default since 1709 | |
Function EnableSMB1 { | |
Write-Host "Enabling SMB 1.0 protocol..." | |
Set-SmbServerConfiguration -EnableSMB1Protocol $true -Force | |
} | |
# Set current network profile to private (allow file sharing, device discovery, etc.) | |
Function SetCurrentNetworkPrivate { | |
Write-Host "Setting current network profile to private..." | |
Set-NetConnectionProfile -NetworkCategory Private | |
} | |
# Set current network profile to public (deny file sharing, device discovery, etc.) | |
Function SetCurrentNetworkPublic { | |
Write-Host "Setting current network profile to public..." | |
Set-NetConnectionProfile -NetworkCategory Public | |
} | |
# Set unknown networks profile to private (allow file sharing, device discovery, etc.) | |
Function SetUnknownNetworksPrivate { | |
Write-Host "Setting unknown networks profile to private..." | |
If (!(Test-Path "HKLM:\SOFTWARE\Policies\Microsoft\Windows NT\CurrentVersion\NetworkList\Signatures\010103000F0000F0010000000F0000F0C967A3643C3AD745950DA7859209176EF5B87C875FA20DF21951640E807D7C24")) { | |
New-Item -Path "HKLM:\SOFTWARE\Policies\Microsoft\Windows NT\CurrentVersion\NetworkList\Signatures\010103000F0000F0010000000F0000F0C967A3643C3AD745950DA7859209176EF5B87C875FA20DF21951640E807D7C24" -Force | Out-Null | |
} | |
Set-ItemProperty -Path "HKLM:\SOFTWARE\Policies\Microsoft\Windows NT\CurrentVersion\NetworkList\Signatures\010103000F0000F0010000000F0000F0C967A3643C3AD745950DA7859209176EF5B87C875FA20DF21951640E807D7C24" -Name "Category" -Type DWord -Value 1 | |
} | |
# Set unknown networks profile to public (deny file sharing, device discovery, etc.) | |
Function SetUnknownNetworksPublic { | |
Write-Host "Setting unknown networks profile to public..." | |
Remove-ItemProperty -Path "HKLM:\SOFTWARE\Policies\Microsoft\Windows NT\CurrentVersion\NetworkList\Signatures\010103000F0000F0010000000F0000F0C967A3643C3AD745950DA7859209176EF5B87C875FA20DF21951640E807D7C24" -Name "Category" -ErrorAction SilentlyContinue | |
} | |
# Disable automatic installation of network devices | |
Function DisableNetDevicesAutoInst { | |
Write-Host "Disabling automatic installation of network devices..." | |
If (!(Test-Path "HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\NcdAutoSetup\Private")) { | |
New-Item -Path "HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\NcdAutoSetup\Private" -Force | Out-Null | |
} | |
Set-ItemProperty -Path "HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\NcdAutoSetup\Private" -Name "AutoSetup" -Type DWord -Value 0 | |
} | |
# Enable automatic installation of network devices | |
Function EnableNetDevicesAutoInst { | |
Write-Host "Enabling automatic installation of network devices..." | |
Remove-ItemProperty -Path "HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\NcdAutoSetup\Private" -Name "AutoSetup" -ErrorAction SilentlyContinue | |
} | |
# Enable Controlled Folder Access (Defender Exploit Guard feature) - Not applicable to Server | |
Function EnableCtrldFolderAccess { | |
Write-Host "Enabling Controlled Folder Access..." | |
Set-MpPreference -EnableControlledFolderAccess Enabled | |
} | |
# Disable Controlled Folder Access (Defender Exploit Guard feature) - Not applicable to Server | |
Function DisableCtrldFolderAccess { | |
Write-Host "Disabling Controlled Folder Access..." | |
Set-MpPreference -EnableControlledFolderAccess Disabled | |
} | |
# Disable Firewall | |
Function DisableFirewall { | |
Write-Host "Disabling Firewall..." | |
If (!(Test-Path "HKLM:\SOFTWARE\Policies\Microsoft\WindowsFirewall\StandardProfile")) { | |
New-Item -Path "HKLM:\SOFTWARE\Policies\Microsoft\WindowsFirewall\StandardProfile" -Force | Out-Null | |
} | |
Set-ItemProperty -Path "HKLM:\SOFTWARE\Policies\Microsoft\WindowsFirewall\StandardProfile" -Name "EnableFirewall" -Type DWord -Value 0 | |
} | |
# Enable Firewall | |
Function EnableFirewall { | |
Write-Host "Enabling Firewall..." | |
Remove-ItemProperty -Path "HKLM:\SOFTWARE\Policies\Microsoft\WindowsFirewall\StandardProfile" -Name "EnableFirewall" -ErrorAction SilentlyContinue | |
} | |
# Disable Windows Defender | |
Function DisableDefender { | |
Write-Host "Disabling Windows Defender..." | |
If (!(Test-Path "HKLM:\SOFTWARE\Policies\Microsoft\Windows Defender")) { | |
New-Item -Path "HKLM:\SOFTWARE\Policies\Microsoft\Windows Defender" -Force | Out-Null | |
} | |
Set-ItemProperty -Path "HKLM:\SOFTWARE\Policies\Microsoft\Windows Defender" -Name "DisableAntiSpyware" -Type DWord -Value 1 | |
Remove-ItemProperty -Path "HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\Run" -Name "SecurityHealth" -ErrorAction SilentlyContinue | |
} | |
# Enable Windows Defender | |
Function EnableDefender { | |
Write-Host "Enabling Windows Defender..." | |
Remove-ItemProperty -Path "HKLM:\SOFTWARE\Policies\Microsoft\Windows Defender" -Name "DisableAntiSpyware" -ErrorAction SilentlyContinue | |
Set-ItemProperty -Path "HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\Run" -Name "SecurityHealth" -Type ExpandString -Value "`"%ProgramFiles%\Windows Defender\MSASCuiL.exe`"" | |
} | |
# Disable Windows Defender Cloud | |
Function DisableDefenderCloud { | |
Write-Host "Disabling Windows Defender Cloud..." | |
If (!(Test-Path "HKLM:\SOFTWARE\Policies\Microsoft\Windows Defender\Spynet")) { | |
New-Item -Path "HKLM:\SOFTWARE\Policies\Microsoft\Windows Defender\Spynet" -Force | Out-Null | |
} | |
Set-ItemProperty -Path "HKLM:\SOFTWARE\Policies\Microsoft\Windows Defender\Spynet" -Name "SpynetReporting" -Type DWord -Value 0 | |
Set-ItemProperty -Path "HKLM:\SOFTWARE\Policies\Microsoft\Windows Defender\Spynet" -Name "SubmitSamplesConsent" -Type DWord -Value 2 | |
} | |
# Enable Windows Defender Cloud | |
Function EnableDefenderCloud { | |
Write-Host "Enabling Windows Defender Cloud..." | |
Remove-ItemProperty -Path "HKLM:\SOFTWARE\Policies\Microsoft\Windows Defender\Spynet" -Name "SpynetReporting" -ErrorAction SilentlyContinue | |
Remove-ItemProperty -Path "HKLM:\SOFTWARE\Policies\Microsoft\Windows Defender\Spynet" -Name "SubmitSamplesConsent" -ErrorAction SilentlyContinue | |
} | |
# Disable offering of Malicious Software Removal Tool through Windows Update | |
Function DisableUpdateMSRT { | |
Write-Host "Disabling Malicious Software Removal Tool offering..." | |
If (!(Test-Path "HKLM:\SOFTWARE\Policies\Microsoft\MRT")) { | |
New-Item -Path "HKLM:\SOFTWARE\Policies\Microsoft\MRT" | Out-Null | |
} | |
Set-ItemProperty -Path "HKLM:\SOFTWARE\Policies\Microsoft\MRT" -Name "DontOfferThroughWUAU" -Type DWord -Value 1 | |
} | |
# Enable offering of Malicious Software Removal Tool through Windows Update | |
Function EnableUpdateMSRT { | |
Write-Host "Enabling Malicious Software Removal Tool offering..." | |
Remove-ItemProperty -Path "HKLM:\SOFTWARE\Policies\Microsoft\MRT" -Name "DontOfferThroughWUAU" -ErrorAction SilentlyContinue | |
} | |
# Disable offering of drivers through Windows Update | |
Function DisableUpdateDriver { | |
Write-Host "Disabling driver offering through Windows Update..." | |
Set-ItemProperty -Path "HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\DriverSearching" -Name "SearchOrderConfig" -Type DWord -Value 0 | |
If (!(Test-Path "HKLM:\SOFTWARE\Policies\Microsoft\Windows\WindowsUpdate")) { | |
New-Item -Path "HKLM:\SOFTWARE\Policies\Microsoft\Windows\WindowsUpdate" | Out-Null | |
} | |
Set-ItemProperty -Path "HKLM:\SOFTWARE\Policies\Microsoft\Windows\WindowsUpdate" -Name "ExcludeWUDriversInQualityUpdate" -Type DWord -Value 1 | |
} | |
# Enable offering of drivers through Windows Update | |
Function EnableUpdateDriver { | |
Write-Host "Enabling driver offering through Windows Update..." | |
Set-ItemProperty -Path "HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\DriverSearching" -Name "SearchOrderConfig" -Type DWord -Value 1 | |
Remove-ItemProperty -Path "HKLM:\SOFTWARE\Policies\Microsoft\Windows\WindowsUpdate" -Name "ExcludeWUDriversInQualityUpdate" -ErrorAction SilentlyContinue | |
} | |
# Disable Windows Update automatic restart | |
Function DisableUpdateRestart { | |
Write-Host "Disabling Windows Update automatic restart..." | |
If (!(Test-Path "HKLM:\SOFTWARE\Policies\Microsoft\Windows\WindowsUpdate\AU")) { | |
New-Item -Path "HKLM:\SOFTWARE\Policies\Microsoft\Windows\WindowsUpdate\AU" -Force | Out-Null | |
} | |
Set-ItemProperty -Path "HKLM:\SOFTWARE\Policies\Microsoft\Windows\WindowsUpdate\AU" -Name "NoAutoRebootWithLoggedOnUsers" -Type DWord -Value 1 | |
Set-ItemProperty -Path "HKLM:\SOFTWARE\Policies\Microsoft\Windows\WindowsUpdate\AU" -Name "AUPowerManagement" -Type DWord -Value 0 | |
} | |
# Enable Windows Update automatic restart | |
Function EnableUpdateRestart { | |
Write-Host "Enabling Windows Update automatic restart..." | |
Remove-ItemProperty -Path "HKLM:\SOFTWARE\Policies\Microsoft\Windows\WindowsUpdate\AU" -Name "NoAutoRebootWithLoggedOnUsers" -ErrorAction SilentlyContinue | |
Remove-ItemProperty -Path "HKLM:\SOFTWARE\Policies\Microsoft\Windows\WindowsUpdate\AU" -Name "AUPowerManagement" -ErrorAction SilentlyContinue | |
} | |
Function EnableUpdateScheduleRestart { | |
Write-Host "Change Windows Updates to 'Notify to schedule restart'" | |
If (-not (Test-Path "HKCU:\SOFTWARE\Microsoft\WindowsUpdate\UX\Settings")) { | |
New-Item -Path HKCU:\SOFTWARE\Microsoft\WindowsUpdate\UX\Settings -Force | Out-Null | |
} | |
Set-ItemProperty -Path HKCU:\SOFTWARE\Microsoft\WindowsUpdate\UX\Settings -Name UxOption -Type DWord -Value 1 | |
If (-not (Test-Path "HKLM:\SOFTWARE\Microsoft\WindowsUpdate\UX\Settings")) { | |
New-Item -Path HKLM:\SOFTWARE\Microsoft\WindowsUpdate\UX\Settings -Force | Out-Null | |
} | |
Set-ItemProperty -Path HKLM:\SOFTWARE\Microsoft\WindowsUpdate\UX\Settings -Name UxOption -Type DWord -Value 1 | |
} | |
Function DisableUpdateScheduleRestart { | |
Write-Host "Change Windows Updates to disable 'Notify to schedule restart'" | |
If (-not (Test-Path "HKCU:\SOFTWARE\Microsoft\WindowsUpdate\UX\Settings")) { | |
New-Item -Path HKCU:\SOFTWARE\Microsoft\WindowsUpdate\UX\Settings -Force | Out-Null | |
} | |
Set-ItemProperty -Path HKCU:\SOFTWARE\Microsoft\WindowsUpdate\UX\Settings -Name UxOption -Type DWord -Value 0 | |
If (-not (Test-Path "HKLM:\SOFTWARE\Microsoft\WindowsUpdate\UX\Settings")) { | |
New-Item -Path HKLM:\SOFTWARE\Microsoft\WindowsUpdate\UX\Settings -Force | Out-Null | |
} | |
Set-ItemProperty -Path HKLM:\SOFTWARE\Microsoft\WindowsUpdate\UX\Settings -Name UxOption -Type DWord -Value 0 | |
} | |
# Stop and disable Home Groups services - Not applicable to Server | |
Function DisableHomeGroups { | |
Write-Host "Stopping and disabling Home Groups services..." | |
Stop-Service "HomeGroupListener" -WarningAction SilentlyContinue | |
Set-Service "HomeGroupListener" -StartupType Disabled | |
Stop-Service "HomeGroupProvider" -WarningAction SilentlyContinue | |
Set-Service "HomeGroupProvider" -StartupType Disabled | |
} | |
# Enable and start Home Groups services - Not applicable to Server | |
Function EnableHomeGroups { | |
Write-Host "Starting and enabling Home Groups services..." | |
Set-Service "HomeGroupListener" -StartupType Manual | |
Set-Service "HomeGroupProvider" -StartupType Manual | |
Start-Service "HomeGroupProvider" -WarningAction SilentlyContinue | |
} | |
# Disable Shared Experiences - Not applicable to Server | |
Function DisableSharedExperiences { | |
Write-Host "Disabling Shared Experiences..." | |
Set-ItemProperty -Path "HKCU:\SOFTWARE\Microsoft\Windows\CurrentVersion\CDP" -Name "RomeSdkChannelUserAuthzPolicy" -Type DWord -Value 0 | |
} | |
# Enable Shared Experiences - Not applicable to Server | |
Function EnableSharedExperiences { | |
Write-Host "Enabling Shared Experiences..." | |
Set-ItemProperty -Path "HKCU:\SOFTWARE\Microsoft\Windows\CurrentVersion\CDP" -Name "RomeSdkChannelUserAuthzPolicy" -Type DWord -Value 1 | |
} | |
# Disable Remote Assistance - Not applicable to Server (unless Remote Assistance is explicitly installed) | |
Function DisableRemoteAssistance { | |
Write-Host "Disabling Remote Assistance..." | |
Set-ItemProperty -Path "HKLM:\SYSTEM\CurrentControlSet\Control\Remote Assistance" -Name "fAllowToGetHelp" -Type DWord -Value 0 | |
} | |
# Enable Remote Assistance - Not applicable to Server (unless Remote Assistance is explicitly installed) | |
Function EnableRemoteAssistance { | |
Write-Host "Enabling Remote Assistance..." | |
Set-ItemProperty -Path "HKLM:\SYSTEM\CurrentControlSet\Control\Remote Assistance" -Name "fAllowToGetHelp" -Type DWord -Value 1 | |
} | |
# Enable Remote Desktop w/o Network Level Authentication | |
Function EnableRemoteDesktop { | |
Write-Host "Enabling Remote Desktop w/o Network Level Authentication..." | |
Set-ItemProperty -Path "HKLM:\SYSTEM\CurrentControlSet\Control\Terminal Server" -Name "fDenyTSConnections" -Type DWord -Value 0 | |
Set-ItemProperty -Path "HKLM:\SYSTEM\CurrentControlSet\Control\Terminal Server\WinStations\RDP-Tcp" -Name "UserAuthentication" -Type DWord -Value 0 | |
} | |
# Disable Remote Desktop | |
Function DisableRemoteDesktop { | |
Write-Host "Disabling Remote Desktop..." | |
Set-ItemProperty -Path "HKLM:\SYSTEM\CurrentControlSet\Control\Terminal Server" -Name "fDenyTSConnections" -Type DWord -Value 1 | |
Set-ItemProperty -Path "HKLM:\SYSTEM\CurrentControlSet\Control\Terminal Server\WinStations\RDP-Tcp" -Name "UserAuthentication" -Type DWord -Value 1 | |
} | |
# Disable Autoplay | |
Function DisableAutoplay { | |
Write-Host "Disabling Autoplay..." | |
Set-ItemProperty -Path "HKCU:\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\AutoplayHandlers" -Name "DisableAutoplay" -Type DWord -Value 1 | |
} | |
# Enable Autoplay | |
Function EnableAutoplay { | |
Write-Host "Enabling Autoplay..." | |
Set-ItemProperty -Path "HKCU:\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\AutoplayHandlers" -Name "DisableAutoplay" -Type DWord -Value 0 | |
} | |
# Disable Autorun for all drives | |
Function DisableAutorun { | |
Write-Host "Disabling Autorun for all drives..." | |
If (!(Test-Path "HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\Policies\Explorer")) { | |
New-Item -Path "HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\Policies\Explorer" | Out-Null | |
} | |
Set-ItemProperty -Path "HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\Policies\Explorer" -Name "NoDriveTypeAutoRun" -Type DWord -Value 255 | |
} | |
# Enable Autorun for removable drives | |
Function EnableAutorun { | |
Write-Host "Enabling Autorun for all drives..." | |
Remove-ItemProperty -Path "HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\Policies\Explorer" -Name "NoDriveTypeAutoRun" -ErrorAction SilentlyContinue | |
} | |
# Enable Storage Sense - automatic disk cleanup - Not applicable to Server | |
Function EnableStorageSense { | |
Write-Host "Enabling Storage Sense..." | |
If (!(Test-Path "HKCU:\SOFTWARE\Microsoft\Windows\CurrentVersion\StorageSense\Parameters\StoragePolicy")) { | |
New-Item -Path "HKCU:\SOFTWARE\Microsoft\Windows\CurrentVersion\StorageSense\Parameters\StoragePolicy" -Force | Out-Null | |
} | |
Set-ItemProperty -Path "HKCU:\SOFTWARE\Microsoft\Windows\CurrentVersion\StorageSense\Parameters\StoragePolicy" -Name "01" -Type DWord -Value 1 | |
Set-ItemProperty -Path "HKCU:\SOFTWARE\Microsoft\Windows\CurrentVersion\StorageSense\Parameters\StoragePolicy" -Name "04" -Type DWord -Value 1 | |
Set-ItemProperty -Path "HKCU:\SOFTWARE\Microsoft\Windows\CurrentVersion\StorageSense\Parameters\StoragePolicy" -Name "08" -Type DWord -Value 1 | |
Set-ItemProperty -Path "HKCU:\SOFTWARE\Microsoft\Windows\CurrentVersion\StorageSense\Parameters\StoragePolicy" -Name "32" -Type DWord -Value 0 | |
Set-ItemProperty -Path "HKCU:\SOFTWARE\Microsoft\Windows\CurrentVersion\StorageSense\Parameters\StoragePolicy" -Name "StoragePoliciesNotified" -Type DWord -Value 1 | |
} | |
# Disable Storage Sense - Not applicable to Server | |
Function DisableStorageSense { | |
Write-Host "Disabling Storage Sense..." | |
Remove-Item -Path "HKCU:\SOFTWARE\Microsoft\Windows\CurrentVersion\StorageSense\Parameters\StoragePolicy" -Recurse -ErrorAction SilentlyContinue | |
} | |
# Disable scheduled defragmentation task | |
Function DisableDefragmentation { | |
Write-Host "Disabling scheduled defragmentation..." | |
Disable-ScheduledTask -TaskName "Microsoft\Windows\Defrag\ScheduledDefrag" | Out-Null | |
} | |
# Enable scheduled defragmentation task | |
Function EnableDefragmentation { | |
Write-Host "Enabling scheduled defragmentation..." | |
Enable-ScheduledTask -TaskName "Microsoft\Windows\Defrag\ScheduledDefrag" | Out-Null | |
} | |
# Stop and disable Superfetch service - Not applicable to Server | |
Function DisableSuperfetch { | |
Write-Host "Stopping and disabling Superfetch service..." | |
Stop-Service "SysMain" -WarningAction SilentlyContinue | |
Set-Service "SysMain" -StartupType Disabled | |
} | |
# Start and enable Superfetch service - Not applicable to Server | |
Function EnableSuperfetch { | |
Write-Host "Starting and enabling Superfetch service..." | |
Set-Service "SysMain" -StartupType Automatic | |
Start-Service "SysMain" -WarningAction SilentlyContinue | |
} | |
# Stop and disable Windows Search indexing service | |
Function DisableIndexing { | |
Write-Host "Stopping and disabling Windows Search indexing service..." | |
Stop-Service "WSearch" -WarningAction SilentlyContinue | |
Set-Service "WSearch" -StartupType Disabled | |
} | |
# Start and enable Windows Search indexing service | |
Function EnableIndexing { | |
Write-Host "Starting and enabling Windows Search indexing service..." | |
Set-Service "WSearch" -StartupType Automatic | |
Set-ItemProperty -Path "HKLM:\SYSTEM\CurrentControlSet\Services\WSearch" -Name "DelayedAutoStart" -Type DWord -Value 1 | |
Start-Service "WSearch" -WarningAction SilentlyContinue | |
} | |
# Set BIOS time to UTC | |
Function SetBIOSTimeUTC { | |
Write-Host "Setting BIOS time to UTC..." | |
Set-ItemProperty -Path "HKLM:\SYSTEM\CurrentControlSet\Control\TimeZoneInformation" -Name "RealTimeIsUniversal" -Type DWord -Value 1 | |
} | |
# Set BIOS time to local time | |
Function SetBIOSTimeLocal { | |
Write-Host "Setting BIOS time to Local time..." | |
Remove-ItemProperty -Path "HKLM:\SYSTEM\CurrentControlSet\Control\TimeZoneInformation" -Name "RealTimeIsUniversal" -ErrorAction SilentlyContinue | |
} | |
# Enable Hibernation - Do not use on Server with automatically started Hyper-V hvboot service as it may lead to BSODs (Win10 with Hyper-V is fine) | |
Function EnableHibernation { | |
Write-Host "Enabling Hibernation..." | |
Set-ItemProperty -Path "HKLM:\System\CurrentControlSet\Control\Session Manager\Power" -Name "HibernteEnabled" -Type Dword -Value 1 | |
If (!(Test-Path "HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\FlyoutMenuSettings")) { | |
New-Item -Path "HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\FlyoutMenuSettings" | Out-Null | |
} | |
Set-ItemProperty -Path "HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\FlyoutMenuSettings" -Name "ShowHibernateOption" -Type Dword -Value 1 | |
} | |
# Disable Hibernation | |
Function DisableHibernation { | |
Write-Host "Disabling Hibernation..." | |
Set-ItemProperty -Path "HKLM:\System\CurrentControlSet\Control\Session Manager\Power" -Name "HibernteEnabled" -Type Dword -Value 0 | |
If (!(Test-Path "HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\FlyoutMenuSettings")) { | |
New-Item -Path "HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\FlyoutMenuSettings" | Out-Null | |
} | |
Set-ItemProperty -Path "HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\FlyoutMenuSettings" -Name "ShowHibernateOption" -Type Dword -Value 0 | |
} | |
# Disable Sleep start menu and keyboard button | |
Function DisableSleepButton { | |
Write-Host "Disabling Sleep start menu and keyboard button..." | |
If (!(Test-Path "HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\FlyoutMenuSettings")) { | |
New-Item -Path "HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\FlyoutMenuSettings" | Out-Null | |
} | |
Set-ItemProperty -Path "HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\FlyoutMenuSettings" -Name "ShowSleepOption" -Type Dword -Value 0 | |
powercfg /SETACVALUEINDEX SCHEME_CURRENT SUB_BUTTONS SBUTTONACTION 0 | |
powercfg /SETDCVALUEINDEX SCHEME_CURRENT SUB_BUTTONS SBUTTONACTION 0 | |
} | |
# Enable Sleep start menu and keyboard button | |
Function EnableSleepButton { | |
Write-Host "Enabling Sleep start menu and keyboard button..." | |
If (!(Test-Path "HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\FlyoutMenuSettings")) { | |
New-Item -Path "HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\FlyoutMenuSettings" | Out-Null | |
} | |
Set-ItemProperty -Path "HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\FlyoutMenuSettings" -Name "ShowSleepOption" -Type Dword -Value 1 | |
powercfg /SETACVALUEINDEX SCHEME_CURRENT SUB_BUTTONS SBUTTONACTION 1 | |
powercfg /SETDCVALUEINDEX SCHEME_CURRENT SUB_BUTTONS SBUTTONACTION 1 | |
} | |
# Disable display and sleep mode timeouts | |
Function DisableSleepTimeout { | |
Write-Host "Disabling display and sleep mode timeouts..." | |
powercfg /X monitor-timeout-ac 0 | |
powercfg /X monitor-timeout-dc 0 | |
powercfg /X standby-timeout-ac 0 | |
powercfg /X standby-timeout-dc 0 | |
} | |
# Enable display and sleep mode timeouts | |
Function EnableSleepTimeout { | |
Write-Host "Enabling display and sleep mode timeouts..." | |
powercfg /X monitor-timeout-ac 10 | |
powercfg /X monitor-timeout-dc 5 | |
powercfg /X standby-timeout-ac 30 | |
powercfg /X standby-timeout-dc 15 | |
} | |
# Disable Fast Startup | |
Function DisableFastStartup { | |
Write-Host "Disabling Fast Startup..." | |
Set-ItemProperty -Path "HKLM:\SYSTEM\CurrentControlSet\Control\Session Manager\Power" -Name "HiberbootEnabled" -Type DWord -Value 0 | |
} | |
# Enable Fast Startup | |
Function EnableFastStartup { | |
Write-Host "Enabling Fast Startup..." | |
Set-ItemProperty -Path "HKLM:\SYSTEM\CurrentControlSet\Control\Session Manager\Power" -Name "HiberbootEnabled" -Type DWord -Value 1 | |
} | |
########## | |
# UI Tweaks | |
########## | |
# Disable Action Center | |
Function DisableActionCenter { | |
Write-Host "Disabling Action Center..." | |
If (!(Test-Path "HKCU:\SOFTWARE\Policies\Microsoft\Windows\Explorer")) { | |
New-Item -Path "HKCU:\SOFTWARE\Policies\Microsoft\Windows\Explorer" | Out-Null | |
} | |
Set-ItemProperty -Path "HKCU:\SOFTWARE\Policies\Microsoft\Windows\Explorer" -Name "DisableNotificationCenter" -Type DWord -Value 1 | |
Set-ItemProperty -Path "HKCU:\SOFTWARE\Microsoft\Windows\CurrentVersion\PushNotifications" -Name "ToastEnabled" -Type DWord -Value 0 | |
} | |
# Enable Action Center | |
Function EnableActionCenter { | |
Write-Host "Enabling Action Center..." | |
Remove-ItemProperty -Path "HKCU:\SOFTWARE\Policies\Microsoft\Windows\Explorer" -Name "DisableNotificationCenter" -ErrorAction SilentlyContinue | |
Remove-ItemProperty -Path "HKCU:\SOFTWARE\Microsoft\Windows\CurrentVersion\PushNotifications" -Name "ToastEnabled" -ErrorAction SilentlyContinue | |
} | |
# Disable Lock screen | |
Function DisableLockScreen { | |
Write-Host "Disabling Lock screen..." | |
If (!(Test-Path "HKLM:\SOFTWARE\Policies\Microsoft\Windows\Personalization")) { | |
New-Item -Path "HKLM:\SOFTWARE\Policies\Microsoft\Windows\Personalization" | Out-Null | |
} | |
Set-ItemProperty -Path "HKLM:\SOFTWARE\Policies\Microsoft\Windows\Personalization" -Name "NoLockScreen" -Type DWord -Value 1 | |
} | |
# Enable Lock screen | |
Function EnableLockScreen { | |
Write-Host "Enabling Lock screen..." | |
Remove-ItemProperty -Path "HKLM:\SOFTWARE\Policies\Microsoft\Windows\Personalization" -Name "NoLockScreen" -ErrorAction SilentlyContinue | |
} | |
# Disable Lock screen (Anniversary Update workaround) - Applicable to 1607 or newer | |
Function DisableLockScreenRS1 { | |
Write-Host "Disabling Lock screen using scheduler workaround..." | |
$service = New-Object -com Schedule.Service | |
$service.Connect() | |
$task = $service.NewTask(0) | |
$task.Settings.DisallowStartIfOnBatteries = $false | |
$trigger = $task.Triggers.Create(9) | |
$trigger = $task.Triggers.Create(11) | |
$trigger.StateChange = 8 | |
$action = $task.Actions.Create(0) | |
$action.Path = "reg.exe" | |
$action.Arguments = "add HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Authentication\LogonUI\SessionData /t REG_DWORD /v AllowLockScreen /d 0 /f" | |
$service.GetFolder("\").RegisterTaskDefinition("Disable LockScreen", $task, 6, "NT AUTHORITY\SYSTEM", $null, 4) | Out-Null | |
} | |
# Enable Lock screen (Anniversary Update workaround) - Applicable to 1607 or newer | |
Function EnableLockScreenRS1 { | |
Write-Host "Enabling Lock screen (removing scheduler workaround)..." | |
Unregister-ScheduledTask -TaskName "Disable LockScreen" -Confirm:$false -ErrorAction SilentlyContinue | |
} | |
# Hide network options from Lock Screen | |
Function HideNetworkFromLockScreen { | |
Write-Host "Hiding network options from Lock Screen..." | |
Set-ItemProperty -Path "HKLM:\SOFTWARE\Policies\Microsoft\Windows\System" -Name "DontDisplayNetworkSelectionUI" -Type DWord -Value 1 | |
} | |
# Show network options on lock screen | |
Function ShowNetworkOnLockScreen { | |
Write-Host "Showing network options on Lock Screen..." | |
Remove-ItemProperty -Path "HKLM:\SOFTWARE\Policies\Microsoft\Windows\System" -Name "DontDisplayNetworkSelectionUI" -ErrorAction SilentlyContinue | |
} | |
# Hide shutdown options from Lock Screen | |
Function HideShutdownFromLockScreen { | |
Write-Host "Hiding shutdown options from Lock Screen..." | |
Set-ItemProperty -Path "HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\Policies\System" -Name "ShutdownWithoutLogon" -Type DWord -Value 0 | |
} | |
# Show shutdown options on lock screen | |
Function ShowShutdownOnLockScreen { | |
Write-Host "Showing shutdown options on Lock Screen..." | |
Set-ItemProperty -Path "HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\Policies\System" -Name "ShutdownWithoutLogon" -Type DWord -Value 1 | |
} | |
# Disable Sticky keys prompt | |
Function DisableStickyKeys { | |
Write-Host "Disabling Sticky keys prompt..." | |
Set-ItemProperty -Path "HKCU:\Control Panel\Accessibility\StickyKeys" -Name "Flags" -Type String -Value "506" | |
} | |
# Enable Sticky keys prompt | |
Function EnableStickyKeys { | |
Write-Host "Enabling Sticky keys prompt..." | |
Set-ItemProperty -Path "HKCU:\Control Panel\Accessibility\StickyKeys" -Name "Flags" -Type String -Value "510" | |
} | |
# Show Task Manager details | |
Function ShowTaskManagerDetails { | |
Write-Host "Showing task manager details..." | |
If (!(Test-Path "HKCU:\Software\Microsoft\Windows\CurrentVersion\TaskManager")) { | |
New-Item -Path "HKCU:\Software\Microsoft\Windows\CurrentVersion\TaskManager" -Force | Out-Null | |
} | |
$preferences = Get-ItemProperty -Path "HKCU:\Software\Microsoft\Windows\CurrentVersion\TaskManager" -Name "Preferences" -ErrorAction SilentlyContinue | |
If (!($preferences)) { | |
$taskmgr = Start-Process -WindowStyle Hidden -FilePath taskmgr.exe -PassThru | |
While (!($preferences)) { | |
Start-Sleep -m 250 | |
$preferences = Get-ItemProperty -Path "HKCU:\Software\Microsoft\Windows\CurrentVersion\TaskManager" -Name "Preferences" -ErrorAction SilentlyContinue | |
} | |
Stop-Process $taskmgr | |
} | |
$preferences.Preferences[28] = 0 | |
Set-ItemProperty -Path "HKCU:\Software\Microsoft\Windows\CurrentVersion\TaskManager" -Name "Preferences" -Type Binary -Value $preferences.Preferences | |
} | |
# Hide Task Manager details | |
Function HideTaskManagerDetails { | |
Write-Host "Hiding task manager details..." | |
$preferences = Get-ItemProperty -Path "HKCU:\Software\Microsoft\Windows\CurrentVersion\TaskManager" -Name "Preferences" -ErrorAction SilentlyContinue | |
If ($preferences) { | |
$preferences.Preferences[28] = 1 | |
Set-ItemProperty -Path "HKCU:\Software\Microsoft\Windows\CurrentVersion\TaskManager" -Name "Preferences" -Type Binary -Value $preferences.Preferences | |
} | |
} | |
# Show file operations details | |
Function ShowFileOperationsDetails { | |
Write-Host "Showing file operations details..." | |
If (!(Test-Path "HKCU:\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\OperationStatusManager")) { | |
New-Item -Path "HKCU:\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\OperationStatusManager" | Out-Null | |
} | |
Set-ItemProperty -Path "HKCU:\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\OperationStatusManager" -Name "EnthusiastMode" -Type DWord -Value 1 | |
} | |
# Hide file operations details | |
Function HideFileOperationsDetails { | |
Write-Host "Hiding file operations details..." | |
Remove-ItemProperty -Path "HKCU:\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\OperationStatusManager" -Name "EnthusiastMode" -ErrorAction SilentlyContinue | |
} | |
# Enable file delete confirmation dialog | |
Function EnableFileDeleteConfirm { | |
Write-Host "Enabling file delete confirmation dialog..." | |
If (!(Test-Path "HKCU:\Software\Microsoft\Windows\CurrentVersion\Policies\Explorer")) { | |
New-Item -Path "HKCU:\Software\Microsoft\Windows\CurrentVersion\Policies\Explorer" | Out-Null | |
} | |
Set-ItemProperty -Path "HKCU:\Software\Microsoft\Windows\CurrentVersion\Policies\Explorer" -Name "ConfirmFileDelete" -Type DWord -Value 1 | |
} | |
# Disable file delete confirmation dialog | |
Function DisableFileDeleteConfirm { | |
Write-Host "Disabling file delete confirmation dialog..." | |
Remove-ItemProperty -Path "HKCU:\Software\Microsoft\Windows\CurrentVersion\Policies\Explorer" -Name "ConfirmFileDelete" -ErrorAction SilentlyContinue | |
} | |
# Hide Taskbar Search button / box | |
Function HideTaskbarSearchBox { | |
Write-Host "Hiding Taskbar Search box / button..." | |
Set-ItemProperty -Path "HKCU:\SOFTWARE\Microsoft\Windows\CurrentVersion\Search" -Name "SearchboxTaskbarMode" -Type DWord -Value 0 | |
} | |
# Show Taskbar Search button / box | |
Function ShowTaskbarSearchIcon { | |
Write-Host "Showing Taskbar Search box / button..." | |
Set-ItemProperty -Path "HKCU:\SOFTWARE\Microsoft\Windows\CurrentVersion\Search" -Name "SearchboxTaskbarMode" -Type DWord -Value 1 | |
} | |
Function ShowTaskbarSearchBox { | |
Write-Host "Showing Taskbar Search box / button..." | |
Set-ItemProperty -Path "HKCU:\SOFTWARE\Microsoft\Windows\CurrentVersion\Search" -Name "SearchboxTaskbarMode" -Type DWord -Value 2 | |
} | |
# Hide Task View button | |
Function HideTaskView { | |
Write-Host "Hiding Task View button..." | |
Set-ItemProperty -Path "HKCU:\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\Advanced" -Name "ShowTaskViewButton" -Type DWord -Value 0 | |
} | |
# Show Task View button | |
Function ShowTaskView { | |
Write-Host "Showing Task View button..." | |
Remove-ItemProperty -Path "HKCU:\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\Advanced" -Name "ShowTaskViewButton" -ErrorAction SilentlyContinue | |
} | |
# Show small icons in taskbar | |
Function ShowSmallTaskbarIcons { | |
Write-Host "Showing small icons in taskbar..." | |
Set-ItemProperty -Path "HKCU:\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\Advanced" -Name "TaskbarSmallIcons" -Type DWord -Value 1 | |
} | |
# Show large icons in taskbar | |
Function ShowLargeTaskbarIcons { | |
Write-Host "Showing large icons in taskbar..." | |
Remove-ItemProperty -Path "HKCU:\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\Advanced" -Name "TaskbarSmallIcons" -ErrorAction SilentlyContinue | |
} | |
# Show titles in taskbar | |
Function ShowTaskbarTitles { | |
Write-Host "Showing titles in taskbar..." | |
Set-ItemProperty -Path "HKCU:\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\Advanced" -Name "TaskbarGlomLevel" -Type DWord -Value 1 | |
} | |
# Hide titles in taskbar | |
Function HideTaskbarTitles { | |
Write-Host "Hiding titles in taskbar..." | |
Remove-ItemProperty -Path "HKCU:\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\Advanced" -Name "TaskbarGlomLevel" -ErrorAction SilentlyContinue | |
} | |
# Hide Taskbar People icon | |
Function HideTaskbarPeopleIcon { | |
Write-Host "Hiding People icon..." | |
If (!(Test-Path "HKCU:\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\Advanced\People")) { | |
New-Item -Path "HKCU:\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\Advanced\People" | Out-Null | |
} | |
Set-ItemProperty -Path "HKCU:\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\Advanced\People" -Name "PeopleBand" -Type DWord -Value 0 | |
} | |
# Show Taskbar People icon | |
Function ShowTaskbarPeopleIcon { | |
Write-Host "Showing People icon..." | |
Remove-ItemProperty -Path "HKCU:\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\Advanced\People" -Name "PeopleBand" -ErrorAction SilentlyContinue | |
} | |
# Enable taskbar autohiding | |
Function EnableAutoHideTaskbar { | |
Write-Host 'Enabling Taskbar Autohide...' | |
try { | |
$CurrSettings = (Get-ItemProperty 'HKCU:\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\StuckRects3').Settings | |
$CurrSettings[8] = 3 | |
Set-ItemProperty -Path 'HKCU:\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer' -Name StuckRects3 -Value $CurrSettings -Type Binary | |
} | |
catch { | |
Write-Warning "Unable to pull the current registry settings!" | |
} | |
} | |
# Disable taskbar autohiding | |
Function DisableAutoHideTaskbar { | |
Write-Host 'Disabling Taskbar Autohide...' | |
try { | |
$CurrSettings = (Get-ItemProperty 'HKCU:\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\StuckRects3').Settings | |
$CurrSettings[8] = 2 | |
Set-ItemProperty -Path 'HKCU:\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer' -Name StuckRects3 -Value $CurrSettings -Type Binary | |
} | |
catch { | |
Write-Warning "Unable to pull the current registry settings!" | |
} | |
} | |
# Dock the taskbar to the left side of the screen | |
Function DockTaskBarLeft { | |
Write-Output "Docking the taskbar to the left side of the screen..." | |
if (Test-Path 'HKCU:\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\StuckRects2') { | |
$CurrPath = 'StuckRects2' | |
} | |
elseif (Test-Path 'HKCU:\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\StuckRects3') { | |
$CurrPath = 'StuckRects3' | |
} | |
else { | |
Write-Warning 'Unable to set the taskbar setting' | |
return | |
} | |
$BasePath = 'HKCU:\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer' | |
$RegPath = Join-Path $BasePath $CurrPath | |
try { | |
$CurrSettings = (Get-ItemProperty $RegPath).Settings | |
$CurrSettings[12] = 3 | |
Set-ItemProperty -Path $BasePath -Name $CurrPath -Value $CurrSettings -Type Binary | |
} | |
catch { | |
Write-Warning "Unable to pull the current registry settings!" | |
} | |
} | |
# Dock the taskbar to the right side of the screen | |
Function DockTaskBarRight { | |
Write-Output "Docking the taskbar to the right side of the screen..." | |
if (Test-Path 'HKCU:\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\StuckRects2') { | |
$CurrPath = 'StuckRects2' | |
} | |
elseif (Test-Path 'HKCU:\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\StuckRects3') { | |
$CurrPath = 'StuckRects3' | |
} | |
else { | |
Write-Warning 'Unable to set the taskbar setting' | |
return | |
} | |
$BasePath = 'HKCU:\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer' | |
$RegPath = Join-Path $BasePath $CurrPath | |
try { | |
$CurrSettings = (Get-ItemProperty $RegPath).Settings | |
$CurrSettings[12] = 2 | |
Set-ItemProperty -Path $BasePath -Name $CurrPath -Value $CurrSettings -Type Binary | |
} | |
catch { | |
Write-Warning "Unable to pull the current registry settings!" | |
} | |
} | |
# Dock the taskbar to the top of the screen | |
Function DockTaskBarTop { | |
Write-Output "Docking the taskbar to the top of the screen..." | |
if (Test-Path 'HKCU:\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\StuckRects2') { | |
$CurrPath = 'StuckRects2' | |
} | |
elseif (Test-Path 'HKCU:\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\StuckRects3') { | |
$CurrPath = 'StuckRects3' | |
} | |
else { | |
Write-Warning 'Unable to set the taskbar setting' | |
return | |
} | |
$BasePath = 'HKCU:\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer' | |
$RegPath = Join-Path $BasePath $CurrPath | |
try { | |
$CurrSettings = (Get-ItemProperty $RegPath).Settings | |
$CurrSettings[12] = 1 | |
Set-ItemProperty -Path $BasePath -Name $CurrPath -Value $CurrSettings -Type Binary | |
} | |
catch { | |
Write-Warning "Unable to pull the current registry settings!" | |
} | |
} | |
# Dock the taskbar to the bottom of the screen | |
Function DockTaskBarBottom { | |
Write-Output "Docking the taskbar to the bottom of the screen..." | |
if (Test-Path 'HKCU:\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\StuckRects2') { | |
$CurrPath = 'StuckRects2' | |
} | |
elseif (Test-Path 'HKCU:\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\StuckRects3') { | |
$CurrPath = 'StuckRects3' | |
} | |
else { | |
Write-Warning 'Unable to set the taskbar setting' | |
return | |
} | |
$BasePath = 'HKCU:\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer' | |
$RegPath = Join-Path $BasePath $CurrPath | |
try { | |
$CurrSettings = (Get-ItemProperty $RegPath).Settings | |
$CurrSettings[12] = 0 | |
Set-ItemProperty -Path $BasePath -Name $CurrPath -Value $CurrSettings -Type Binary | |
} | |
catch { | |
Write-Warning "Unable to pull the current registry settings!" | |
} | |
} | |
# Show all tray icons | |
Function ShowTrayIcons { | |
Write-Host "Showing all tray icons..." | |
Set-ItemProperty -Path "HKCU:\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer" -Name "EnableAutoTray" -Type DWord -Value 0 | |
} | |
# Hide tray icons as needed | |
Function HideTrayIcons { | |
Write-Host "Hiding tray icons..." | |
Remove-ItemProperty -Path "HKCU:\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer" -Name "EnableAutoTray" -ErrorAction SilentlyContinue | |
} | |
# Show known file extensions | |
Function ShowKnownExtensions { | |
Write-Host "Showing known file extensions..." | |
Set-ItemProperty -Path "HKCU:\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\Advanced" -Name "HideFileExt" -Type DWord -Value 0 | |
} | |
# Hide known file extensions | |
Function HideKnownExtensions { | |
Write-Host "Hiding known file extensions..." | |
Set-ItemProperty -Path "HKCU:\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\Advanced" -Name "HideFileExt" -Type DWord -Value 1 | |
} | |
# Show hidden files | |
Function ShowHiddenFiles { | |
Write-Host "Showing hidden files..." | |
Set-ItemProperty -Path "HKCU:\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\Advanced" -Name "Hidden" -Type DWord -Value 1 | |
} | |
# Hide hidden files | |
Function HideHiddenFiles { | |
Write-Host "Hiding hidden files..." | |
Set-ItemProperty -Path "HKCU:\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\Advanced" -Name "Hidden" -Type DWord -Value 2 | |
} | |
# Hide sync provider notifications | |
Function HideSyncNotifications { | |
Write-Host "Hiding sync provider notifications..." | |
Set-ItemProperty -Path "HKCU:\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\Advanced" -Name "ShowSyncProviderNotifications" -Type DWord -Value 0 | |
} | |
# Show sync provider notifications | |
Function ShowSyncNotifications { | |
Write-Host "Showing sync provider notifications..." | |
Set-ItemProperty -Path "HKCU:\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\Advanced" -Name "ShowSyncProviderNotifications" -Type DWord -Value 1 | |
} | |
# Hide recently and frequently used item shortcuts in Explorer | |
Function HideRecentShortcuts { | |
Write-Host "Hiding recent shortcuts..." | |
Set-ItemProperty -Path "HKCU:\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer" -Name "ShowRecent" -Type DWord -Value 0 | |
Set-ItemProperty -Path "HKCU:\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer" -Name "ShowFrequent" -Type DWord -Value 0 | |
} | |
# Show recently and frequently used item shortcuts in Explorer | |
Function ShowRecentShortcuts { | |
Write-Host "Showing recent shortcuts..." | |
Remove-ItemProperty -Path "HKCU:\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer" -Name "ShowRecent" -ErrorAction SilentlyContinue | |
Remove-ItemProperty -Path "HKCU:\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer" -Name "ShowFrequent" -ErrorAction SilentlyContinue | |
} | |
# Change default Explorer view to This PC | |
Function SetExplorerThisPC { | |
Write-Host "Changing default Explorer view to This PC..." | |
Set-ItemProperty -Path "HKCU:\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\Advanced" -Name "LaunchTo" -Type DWord -Value 1 | |
} | |
# Change default Explorer view to Quick Access | |
Function SetExplorerQuickAccess { | |
Write-Host "Changing default Explorer view to Quick Access..." | |
Remove-ItemProperty -Path "HKCU:\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\Advanced" -Name "LaunchTo" -ErrorAction SilentlyContinue | |
} | |
# Show This PC shortcut on desktop | |
Function ShowThisPCOnDesktop { | |
Write-Host "Showing This PC shortcut on desktop..." | |
If (!(Test-Path "HKCU:\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\HideDesktopIcons\ClassicStartMenu")) { | |
New-Item -Path "HKCU:\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\HideDesktopIcons\ClassicStartMenu" -Force | Out-Null | |
} | |
Set-ItemProperty -Path "HKCU:\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\HideDesktopIcons\ClassicStartMenu" -Name "{20D04FE0-3AEA-1069-A2D8-08002B30309D}" -Type DWord -Value 0 | |
If (!(Test-Path "HKCU:\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\HideDesktopIcons\NewStartPanel")) { | |
New-Item -Path "HKCU:\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\HideDesktopIcons\NewStartPanel" -Force | Out-Null | |
} | |
Set-ItemProperty -Path "HKCU:\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\HideDesktopIcons\NewStartPanel" -Name "{20D04FE0-3AEA-1069-A2D8-08002B30309D}" -Type DWord -Value 0 | |
} | |
# Hide This PC shortcut from desktop | |
Function HideThisPCFromDesktop { | |
Write-Host "Hiding This PC shortcut from desktop..." | |
Remove-ItemProperty -Path "HKCU:\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\HideDesktopIcons\ClassicStartMenu" -Name "{20D04FE0-3AEA-1069-A2D8-08002B30309D}" -ErrorAction SilentlyContinue | |
Remove-ItemProperty -Path "HKCU:\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\HideDesktopIcons\NewStartPanel" -Name "{20D04FE0-3AEA-1069-A2D8-08002B30309D}" -ErrorAction SilentlyContinue | |
} | |
# Show User Folder shortcut on desktop | |
Function ShowUserFolderOnDesktop { | |
Write-Host "Showing User Folder shortcut on desktop..." | |
If (!(Test-Path "HKCU:\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\HideDesktopIcons\ClassicStartMenu")) { | |
New-Item -Path "HKCU:\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\HideDesktopIcons\ClassicStartMenu" -Force | Out-Null | |
} | |
Set-ItemProperty -Path "HKCU:\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\HideDesktopIcons\ClassicStartMenu" -Name "{59031a47-3f72-44a7-89c5-5595fe6b30ee}" -Type DWord -Value 0 | |
If (!(Test-Path "HKCU:\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\HideDesktopIcons\NewStartPanel")) { | |
New-Item -Path "HKCU:\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\HideDesktopIcons\NewStartPanel" -Force | Out-Null | |
} | |
Set-ItemProperty -Path "HKCU:\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\HideDesktopIcons\NewStartPanel" -Name "{59031a47-3f72-44a7-89c5-5595fe6b30ee}" -Type DWord -Value 0 | |
} | |
# Hide User Folder shortcut from desktop | |
Function HideUserFolderFromDesktop { | |
Write-Host "Hiding User Folder shortcut from desktop..." | |
Remove-ItemProperty -Path "HKCU:\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\HideDesktopIcons\ClassicStartMenu" -Name "{59031a47-3f72-44a7-89c5-5595fe6b30ee}" -ErrorAction SilentlyContinue | |
Remove-ItemProperty -Path "HKCU:\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\HideDesktopIcons\NewStartPanel" -Name "{59031a47-3f72-44a7-89c5-5595fe6b30ee}" -ErrorAction SilentlyContinue | |
} | |
# Hide Desktop icon from This PC - The icon remains in personal folders and open/save dialogs | |
Function HideDesktopFromThisPC { | |
Write-Host "Hiding Desktop icon from This PC..." | |
Remove-Item -Path "HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\MyComputer\NameSpace\{B4BFCC3A-DB2C-424C-B029-7FE99A87C641}" -Recurse -ErrorAction SilentlyContinue | |
} | |
# Show Desktop icon in This PC | |
Function ShowDesktopInThisPC { | |
Write-Host "Showing Desktop icon in This PC..." | |
If (!(Test-Path "HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\MyComputer\NameSpace\{B4BFCC3A-DB2C-424C-B029-7FE99A87C641}")) { | |
New-Item -Path "HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\MyComputer\NameSpace\{B4BFCC3A-DB2C-424C-B029-7FE99A87C641}" | Out-Null | |
} | |
} | |
# Hide Desktop icon from Explorer namespace - Hides the icon also from personal folders and open/save dialogs | |
Function HideDesktopFromExplorer { | |
Write-Host "Hiding Desktop icon from Explorer namespace..." | |
Set-ItemProperty -Path "HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\FolderDescriptions\{B4BFCC3A-DB2C-424C-B029-7FE99A87C641}\PropertyBag" -Name "ThisPCPolicy" -Type String -Value "Hide" | |
Set-ItemProperty -Path "HKLM:\SOFTWARE\Wow6432Node\Microsoft\Windows\CurrentVersion\Explorer\FolderDescriptions\{B4BFCC3A-DB2C-424C-B029-7FE99A87C641}\PropertyBag" -Name "ThisPCPolicy" -Type String -Value "Hide" | |
} | |
# Show Desktop icon in Explorer namespace | |
Function ShowDesktopInExplorer { | |
Write-Host "Showing Desktop icon in Explorer namespace..." | |
Set-ItemProperty -Path "HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\FolderDescriptions\{B4BFCC3A-DB2C-424C-B029-7FE99A87C641}\PropertyBag" -Name "ThisPCPolicy" -Type String -Value "Show" | |
Set-ItemProperty -Path "HKLM:\SOFTWARE\Wow6432Node\Microsoft\Windows\CurrentVersion\Explorer\FolderDescriptions\{B4BFCC3A-DB2C-424C-B029-7FE99A87C641}\PropertyBag" -Name "ThisPCPolicy" -Type String -Value "Show" | |
} | |
# Hide Documents icon from This PC - The icon remains in personal folders and open/save dialogs | |
Function HideDocumentsFromThisPC { | |
Write-Host "Hiding Documents icon from This PC..." | |
Remove-Item -Path "HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\MyComputer\NameSpace\{d3162b92-9365-467a-956b-92703aca08af}" -Recurse -ErrorAction SilentlyContinue | |
Remove-Item -Path "HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\MyComputer\NameSpace\{A8CDFF1C-4878-43be-B5FD-F8091C1C60D0}" -Recurse -ErrorAction SilentlyContinue | |
} | |
# Show Documents icon in This PC | |
Function ShowDocumentsInThisPC { | |
Write-Host "Showing Documents icon in This PC..." | |
If (!(Test-Path "HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\MyComputer\NameSpace\{d3162b92-9365-467a-956b-92703aca08af}")) { | |
New-Item -Path "HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\MyComputer\NameSpace\{d3162b92-9365-467a-956b-92703aca08af}" | Out-Null | |
} | |
If (!(Test-Path "HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\MyComputer\NameSpace\{A8CDFF1C-4878-43be-B5FD-F8091C1C60D0}")) { | |
New-Item -Path "HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\MyComputer\NameSpace\{A8CDFF1C-4878-43be-B5FD-F8091C1C60D0}" | Out-Null | |
} | |
} | |
# Hide Documents icon from Explorer namespace - Hides the icon also from personal folders and open/save dialogs | |
Function HideDocumentsFromExplorer { | |
Write-Host "Hiding Documents icon from Explorer namespace..." | |
Set-ItemProperty -Path "HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\FolderDescriptions\{f42ee2d3-909f-4907-8871-4c22fc0bf756}\PropertyBag" -Name "ThisPCPolicy" -Type String -Value "Hide" | |
Set-ItemProperty -Path "HKLM:\SOFTWARE\Wow6432Node\Microsoft\Windows\CurrentVersion\Explorer\FolderDescriptions\{f42ee2d3-909f-4907-8871-4c22fc0bf756}\PropertyBag" -Name "ThisPCPolicy" -Type String -Value "Hide" | |
} | |
# Show Documents icon in Explorer namespace | |
Function ShowDocumentsInExplorer { | |
Write-Host "Showing Documents icon in Explorer namespace..." | |
Set-ItemProperty -Path "HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\FolderDescriptions\{f42ee2d3-909f-4907-8871-4c22fc0bf756}\PropertyBag" -Name "ThisPCPolicy" -Type String -Value "Show" | |
Set-ItemProperty -Path "HKLM:\SOFTWARE\Wow6432Node\Microsoft\Windows\CurrentVersion\Explorer\FolderDescriptions\{f42ee2d3-909f-4907-8871-4c22fc0bf756}\PropertyBag" -Name "ThisPCPolicy" -Type String -Value "Show" | |
} | |
# Hide Downloads icon from This PC - The icon remains in personal folders and open/save dialogs | |
Function HideDownloadsFromThisPC { | |
Write-Host "Hiding Downloads icon from This PC..." | |
Remove-Item -Path "HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\MyComputer\NameSpace\{088e3905-0323-4b02-9826-5d99428e115f}" -Recurse -ErrorAction SilentlyContinue | |
Remove-Item -Path "HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\MyComputer\NameSpace\{374DE290-123F-4565-9164-39C4925E467B}" -Recurse -ErrorAction SilentlyContinue | |
} | |
# Show Downloads icon in This PC | |
Function ShowDownloadsInThisPC { | |
Write-Host "Showing Downloads icon in This PC..." | |
If (!(Test-Path "HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\MyComputer\NameSpace\{088e3905-0323-4b02-9826-5d99428e115f}")) { | |
New-Item -Path "HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\MyComputer\NameSpace\{088e3905-0323-4b02-9826-5d99428e115f}" | Out-Null | |
} | |
If (!(Test-Path "HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\MyComputer\NameSpace\{374DE290-123F-4565-9164-39C4925E467B}")) { | |
New-Item -Path "HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\MyComputer\NameSpace\{374DE290-123F-4565-9164-39C4925E467B}" | Out-Null | |
} | |
} | |
# Hide Downloads icon from Explorer namespace - Hides the icon also from personal folders and open/save dialogs | |
Function HideDownloadsFromExplorer { | |
Write-Host "Hiding Downloads icon from Explorer namespace..." | |
Set-ItemProperty -Path "HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\FolderDescriptions\{7d83ee9b-2244-4e70-b1f5-5393042af1e4}\PropertyBag" -Name "ThisPCPolicy" -Type String -Value "Hide" | |
Set-ItemProperty -Path "HKLM:\SOFTWARE\Wow6432Node\Microsoft\Windows\CurrentVersion\Explorer\FolderDescriptions\{7d83ee9b-2244-4e70-b1f5-5393042af1e4}\PropertyBag" -Name "ThisPCPolicy" -Type String -Value "Hide" | |
} | |
# Show Downloads icon in Explorer namespace | |
Function ShowDownloadsInExplorer { | |
Write-Host "Showing Downloads icon in Explorer namespace..." | |
Set-ItemProperty -Path "HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\FolderDescriptions\{7d83ee9b-2244-4e70-b1f5-5393042af1e4}\PropertyBag" -Name "ThisPCPolicy" -Type String -Value "Show" | |
Set-ItemProperty -Path "HKLM:\SOFTWARE\Wow6432Node\Microsoft\Windows\CurrentVersion\Explorer\FolderDescriptions\{7d83ee9b-2244-4e70-b1f5-5393042af1e4}\PropertyBag" -Name "ThisPCPolicy" -Type String -Value "Show" | |
} | |
# Hide Music icon from This PC - The icon remains in personal folders and open/save dialogs | |
Function HideMusicFromThisPC { | |
Write-Host "Hiding Music icon from This PC..." | |
Remove-Item -Path "HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\MyComputer\NameSpace\{3dfdf296-dbec-4fb4-81d1-6a3438bcf4de}" -Recurse -ErrorAction SilentlyContinue | |
Remove-Item -Path "HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\MyComputer\NameSpace\{1CF1260C-4DD0-4ebb-811F-33C572699FDE}" -Recurse -ErrorAction SilentlyContinue | |
} | |
# Show Music icon in This PC | |
Function ShowMusicInThisPC { | |
Write-Host "Showing Music icon in This PC..." | |
If (!(Test-Path "HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\MyComputer\NameSpace\{3dfdf296-dbec-4fb4-81d1-6a3438bcf4de}")) { | |
New-Item -Path "HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\MyComputer\NameSpace\{3dfdf296-dbec-4fb4-81d1-6a3438bcf4de}" | Out-Null | |
} | |
If (!(Test-Path "HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\MyComputer\NameSpace\{1CF1260C-4DD0-4ebb-811F-33C572699FDE}")) { | |
New-Item -Path "HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\MyComputer\NameSpace\{1CF1260C-4DD0-4ebb-811F-33C572699FDE}" | Out-Null | |
} | |
} | |
# Hide Music icon from Explorer namespace - Hides the icon also from personal folders and open/save dialogs | |
Function HideMusicFromExplorer { | |
Write-Host "Hiding Music icon from Explorer namespace..." | |
Set-ItemProperty -Path "HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\FolderDescriptions\{a0c69a99-21c8-4671-8703-7934162fcf1d}\PropertyBag" -Name "ThisPCPolicy" -Type String -Value "Hide" | |
Set-ItemProperty -Path "HKLM:\SOFTWARE\Wow6432Node\Microsoft\Windows\CurrentVersion\Explorer\FolderDescriptions\{a0c69a99-21c8-4671-8703-7934162fcf1d}\PropertyBag" -Name "ThisPCPolicy" -Type String -Value "Hide" | |
} | |
# Show Music icon in Explorer namespace | |
Function ShowMusicInExplorer { | |
Write-Host "Showing Music icon in Explorer namespace..." | |
Set-ItemProperty -Path "HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\FolderDescriptions\{a0c69a99-21c8-4671-8703-7934162fcf1d}\PropertyBag" -Name "ThisPCPolicy" -Type String -Value "Show" | |
Set-ItemProperty -Path "HKLM:\SOFTWARE\Wow6432Node\Microsoft\Windows\CurrentVersion\Explorer\FolderDescriptions\{a0c69a99-21c8-4671-8703-7934162fcf1d}\PropertyBag" -Name "ThisPCPolicy" -Type String -Value "Show" | |
} | |
# Hide Pictures icon from This PC - The icon remains in personal folders and open/save dialogs | |
Function HidePicturesFromThisPC { | |
Write-Host "Hiding Pictures icon from This PC..." | |
Remove-Item -Path "HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\MyComputer\NameSpace\{24ad3ad4-a569-4530-98e1-ab02f9417aa8}" -Recurse -ErrorAction SilentlyContinue | |
Remove-Item -Path "HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\MyComputer\NameSpace\{3ADD1653-EB32-4cb0-BBD7-DFA0ABB5ACCA}" -Recurse -ErrorAction SilentlyContinue | |
} | |
# Show Pictures icon in This PC | |
Function ShowPicturesInThisPC { | |
Write-Host "Showing Pictures icon in This PC..." | |
If (!(Test-Path "HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\MyComputer\NameSpace\{24ad3ad4-a569-4530-98e1-ab02f9417aa8}")) { | |
New-Item -Path "HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\MyComputer\NameSpace\{24ad3ad4-a569-4530-98e1-ab02f9417aa8}" | Out-Null | |
} | |
If (!(Test-Path "HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\MyComputer\NameSpace\{3ADD1653-EB32-4cb0-BBD7-DFA0ABB5ACCA}")) { | |
New-Item -Path "HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\MyComputer\NameSpace\{3ADD1653-EB32-4cb0-BBD7-DFA0ABB5ACCA}" | Out-Null | |
} | |
} | |
# Hide Pictures icon from Explorer namespace - Hides the icon also from personal folders and open/save dialogs | |
Function HidePicturesFromExplorer { | |
Write-Host "Hiding Pictures icon from Explorer namespace..." | |
Set-ItemProperty -Path "HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\FolderDescriptions\{0ddd015d-b06c-45d5-8c4c-f59713854639}\PropertyBag" -Name "ThisPCPolicy" -Type String -Value "Hide" | |
Set-ItemProperty -Path "HKLM:\SOFTWARE\Wow6432Node\Microsoft\Windows\CurrentVersion\Explorer\FolderDescriptions\{0ddd015d-b06c-45d5-8c4c-f59713854639}\PropertyBag" -Name "ThisPCPolicy" -Type String -Value "Hide" | |
} | |
# Show Pictures icon in Explorer namespace | |
Function ShowPicturesInExplorer { | |
Write-Host "Showing Pictures icon in Explorer namespace..." | |
Set-ItemProperty -Path "HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\FolderDescriptions\{0ddd015d-b06c-45d5-8c4c-f59713854639}\PropertyBag" -Name "ThisPCPolicy" -Type String -Value "Show" | |
Set-ItemProperty -Path "HKLM:\SOFTWARE\Wow6432Node\Microsoft\Windows\CurrentVersion\Explorer\FolderDescriptions\{0ddd015d-b06c-45d5-8c4c-f59713854639}\PropertyBag" -Name "ThisPCPolicy" -Type String -Value "Show" | |
} | |
# Hide Videos icon from This PC - The icon remains in personal folders and open/save dialogs | |
Function HideVideosFromThisPC { | |
Write-Host "Hiding Videos icon from This PC..." | |
Remove-Item -Path "HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\MyComputer\NameSpace\{f86fa3ab-70d2-4fc7-9c99-fcbf05467f3a}" -Recurse -ErrorAction SilentlyContinue | |
Remove-Item -Path "HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\MyComputer\NameSpace\{A0953C92-50DC-43bf-BE83-3742FED03C9C}" -Recurse -ErrorAction SilentlyContinue | |
} | |
# Show Videos icon in This PC | |
Function ShowVideosInThisPC { | |
Write-Host "Showing Videos icon in This PC..." | |
If (!(Test-Path "HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\MyComputer\NameSpace\{f86fa3ab-70d2-4fc7-9c99-fcbf05467f3a}")) { | |
New-Item -Path "HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\MyComputer\NameSpace\{f86fa3ab-70d2-4fc7-9c99-fcbf05467f3a}" | Out-Null | |
} | |
If (!(Test-Path "HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\MyComputer\NameSpace\{A0953C92-50DC-43bf-BE83-3742FED03C9C}")) { | |
New-Item -Path "HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\MyComputer\NameSpace\{A0953C92-50DC-43bf-BE83-3742FED03C9C}" | Out-Null | |
} | |
} | |
# Hide Videos icon from Explorer namespace - Hides the icon also from personal folders and open/save dialogs | |
Function HideVideosFromExplorer { | |
Write-Host "Hiding Videos icon from Explorer namespace..." | |
Set-ItemProperty -Path "HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\FolderDescriptions\{35286a68-3c57-41a1-bbb1-0eae73d76c95}\PropertyBag" -Name "ThisPCPolicy" -Type String -Value "Hide" | |
Set-ItemProperty -Path "HKLM:\SOFTWARE\Wow6432Node\Microsoft\Windows\CurrentVersion\Explorer\FolderDescriptions\{35286a68-3c57-41a1-bbb1-0eae73d76c95}\PropertyBag" -Name "ThisPCPolicy" -Type String -Value "Hide" | |
} | |
# Show Videos icon in Explorer namespace | |
Function ShowVideosInExplorer { | |
Write-Host "Showing Videos icon in Explorer namespace..." | |
Set-ItemProperty -Path "HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\FolderDescriptions\{35286a68-3c57-41a1-bbb1-0eae73d76c95}\PropertyBag" -Name "ThisPCPolicy" -Type String -Value "Show" | |
Set-ItemProperty -Path "HKLM:\SOFTWARE\Wow6432Node\Microsoft\Windows\CurrentVersion\Explorer\FolderDescriptions\{35286a68-3c57-41a1-bbb1-0eae73d76c95}\PropertyBag" -Name "ThisPCPolicy" -Type String -Value "Show" | |
} | |
# Hide 3D Objects icon from This PC - The icon remains in personal folders and open/save dialogs | |
Function Hide3DObjectsFromThisPC { | |
Write-Host "Hiding 3D Objects icon from This PC..." | |
Remove-Item -Path "HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\MyComputer\NameSpace\{0DB7E03F-FC29-4DC6-9020-FF41B59E513A}" -Recurse -ErrorAction SilentlyContinue | |
} | |
# Show 3D Objects icon in This PC | |
Function Show3DObjectsInThisPC { | |
Write-Host "Showing 3D Objects icon in This PC..." | |
If (!(Test-Path "HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\MyComputer\NameSpace\{0DB7E03F-FC29-4DC6-9020-FF41B59E513A}")) { | |
New-Item -Path "HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\MyComputer\NameSpace\{0DB7E03F-FC29-4DC6-9020-FF41B59E513A}" | Out-Null | |
} | |
} | |
# Hide 3D Objects icon from Explorer namespace - Hides the icon also from personal folders and open/save dialogs | |
Function Hide3DObjectsFromExplorer { | |
Write-Host "Hiding 3D Objects icon from Explorer namespace..." | |
If (!(Test-Path "HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\FolderDescriptions\{31C0DD25-9439-4F12-BF41-7FF4EDA38722}\PropertyBag")) { | |
New-Item -Path "HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\FolderDescriptions\{31C0DD25-9439-4F12-BF41-7FF4EDA38722}\PropertyBag" -Force | Out-Null | |
} | |
Set-ItemProperty -Path "HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\FolderDescriptions\{31C0DD25-9439-4F12-BF41-7FF4EDA38722}\PropertyBag" -Name "ThisPCPolicy" -Type String -Value "Hide" | |
If (!(Test-Path "HKLM:\SOFTWARE\Wow6432Node\Microsoft\Windows\CurrentVersion\Explorer\FolderDescriptions\{31C0DD25-9439-4F12-BF41-7FF4EDA38722}\PropertyBag")) { | |
New-Item -Path "HKLM:\SOFTWARE\Wow6432Node\Microsoft\Windows\CurrentVersion\Explorer\FolderDescriptions\{31C0DD25-9439-4F12-BF41-7FF4EDA38722}\PropertyBag" -Force | Out-Null | |
} | |
Set-ItemProperty -Path "HKLM:\SOFTWARE\Wow6432Node\Microsoft\Windows\CurrentVersion\Explorer\FolderDescriptions\{31C0DD25-9439-4F12-BF41-7FF4EDA38722}\PropertyBag" -Name "ThisPCPolicy" -Type String -Value "Hide" | |
} | |
# Show 3D Objects icon in Explorer namespace | |
Function Show3DObjectsInExplorer { | |
Write-Host "Showing 3D Objects icon in Explorer namespace..." | |
Remove-ItemProperty -Path "HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\FolderDescriptions\{31C0DD25-9439-4F12-BF41-7FF4EDA38722}\PropertyBag" -Name "ThisPCPolicy" -ErrorAction SilentlyContinue | |
Remove-ItemProperty -Path "HKLM:\SOFTWARE\Wow6432Node\Microsoft\Windows\CurrentVersion\Explorer\FolderDescriptions\{31C0DD25-9439-4F12-BF41-7FF4EDA38722}\PropertyBag" -Name "ThisPCPolicy" -ErrorAction SilentlyContinue | |
} | |
# Set Control Panel view to icons (Classic) - Note: May trigger antimalware | |
Function SetControlPanelViewIcons { | |
Write-Host "Setting Control Panel view to icons..." | |
Set-ItemProperty -Path "HKLM:\Software\Microsoft\Windows\CurrentVersion\Policies\Explorer" -Name "ForceClassicControlPanel" -Type DWord -Value 1 | |
} | |
# Set Control Panel view to categories | |
Function SetControlPanelViewCategories { | |
Write-Host "Setting Control Panel view to categories..." | |
Remove-ItemProperty -Path "HKLM:\Software\Microsoft\Windows\CurrentVersion\Policies\Explorer" -Name "ForceClassicControlPanel" -ErrorAction SilentlyContinue | |
} | |
# Adjusts visual effects for performance - Disables animations, transparency etc. but leaves font smoothing and miniatures enabled | |
Function SetVisualFXPerformance { | |
Write-Host "Adjusting visual effects for performance..." | |
Set-ItemProperty -Path "HKCU:\Control Panel\Desktop" -Name "DragFullWindows" -Type String -Value 0 | |
Set-ItemProperty -Path "HKCU:\Control Panel\Desktop" -Name "MenuShowDelay" -Type String -Value 0 | |
Set-ItemProperty -Path "HKCU:\Control Panel\Desktop" -Name "UserPreferencesMask" -Type Binary -Value ([byte[]](0x90, 0x12, 0x03, 0x80, 0x10, 0x00, 0x00, 0x00)) | |
Set-ItemProperty -Path "HKCU:\Control Panel\Desktop\WindowMetrics" -Name "MinAnimate" -Type String -Value 0 | |
Set-ItemProperty -Path "HKCU:\Control Panel\Keyboard" -Name "KeyboardDelay" -Type DWord -Value 0 | |
Set-ItemProperty -Path "HKCU:\Software\Microsoft\Windows\CurrentVersion\Explorer\Advanced" -Name "ListviewAlphaSelect" -Type DWord -Value 0 | |
Set-ItemProperty -Path "HKCU:\Software\Microsoft\Windows\CurrentVersion\Explorer\Advanced" -Name "ListviewShadow" -Type DWord -Value 0 | |
Set-ItemProperty -Path "HKCU:\Software\Microsoft\Windows\CurrentVersion\Explorer\Advanced" -Name "TaskbarAnimations" -Type DWord -Value 0 | |
Set-ItemProperty -Path "HKCU:\Software\Microsoft\Windows\CurrentVersion\Explorer\VisualEffects" -Name "VisualFXSetting" -Type DWord -Value 3 | |
Set-ItemProperty -Path "HKCU:\Software\Microsoft\Windows\DWM" -Name "EnableAeroPeek" -Type DWord -Value 0 | |
} | |
# Adjusts visual effects for appearance | |
Function SetVisualFXAppearance { | |
Write-Host "Adjusting visual effects for appearance..." | |
Set-ItemProperty -Path "HKCU:\Control Panel\Desktop" -Name "DragFullWindows" -Type String -Value 1 | |
Set-ItemProperty -Path "HKCU:\Control Panel\Desktop" -Name "MenuShowDelay" -Type String -Value 400 | |
Set-ItemProperty -Path "HKCU:\Control Panel\Desktop" -Name "UserPreferencesMask" -Type Binary -Value ([byte[]](0x9E, 0x1E, 0x07, 0x80, 0x12, 0x00, 0x00, 0x00)) | |
Set-ItemProperty -Path "HKCU:\Control Panel\Desktop\WindowMetrics" -Name "MinAnimate" -Type String -Value 1 | |
Set-ItemProperty -Path "HKCU:\Control Panel\Keyboard" -Name "KeyboardDelay" -Type DWord -Value 1 | |
Set-ItemProperty -Path "HKCU:\Software\Microsoft\Windows\CurrentVersion\Explorer\Advanced" -Name "ListviewAlphaSelect" -Type DWord -Value 1 | |
Set-ItemProperty -Path "HKCU:\Software\Microsoft\Windows\CurrentVersion\Explorer\Advanced" -Name "ListviewShadow" -Type DWord -Value 1 | |
Set-ItemProperty -Path "HKCU:\Software\Microsoft\Windows\CurrentVersion\Explorer\Advanced" -Name "TaskbarAnimations" -Type DWord -Value 1 | |
Set-ItemProperty -Path "HKCU:\Software\Microsoft\Windows\CurrentVersion\Explorer\VisualEffects" -Name "VisualFXSetting" -Type DWord -Value 3 | |
Set-ItemProperty -Path "HKCU:\Software\Microsoft\Windows\DWM" -Name "EnableAeroPeek" -Type DWord -Value 1 | |
} | |
# Disable thumbnails, show only file extension icons | |
Function DisableThumbnails { | |
Write-Host "Disabling thumbnails..." | |
Set-ItemProperty -Path "HKCU:\Software\Microsoft\Windows\CurrentVersion\Explorer\Advanced" -Name "IconsOnly" -Type DWord -Value 1 | |
} | |
# Enable thumbnails | |
Function EnableThumbnails { | |
Write-Host "Enabling thumbnails..." | |
Set-ItemProperty -Path "HKCU:\Software\Microsoft\Windows\CurrentVersion\Explorer\Advanced" -Name "IconsOnly" -Type DWord -Value 0 | |
} | |
# Disable creation of Thumbs.db thumbnail cache files | |
Function DisableThumbsDB { | |
Write-Host "Disabling creation of Thumbs.db..." | |
Set-ItemProperty -Path "HKCU:\Software\Microsoft\Windows\CurrentVersion\Explorer\Advanced" -Name "DisableThumbnailCache" -Type DWord -Value 1 | |
Set-ItemProperty -Path "HKCU:\Software\Microsoft\Windows\CurrentVersion\Explorer\Advanced" -Name "DisableThumbsDBOnNetworkFolders" -Type DWord -Value 1 | |
} | |
# Enable creation of Thumbs.db thumbnail cache files | |
Function EnableThumbsDB { | |
Write-Host "Enable creation of Thumbs.db..." | |
Remove-ItemProperty -Path "HKCU:\Software\Microsoft\Windows\CurrentVersion\Explorer\Advanced" -Name "DisableThumbnailCache" -ErrorAction SilentlyContinue | |
Remove-ItemProperty -Path "HKCU:\Software\Microsoft\Windows\CurrentVersion\Explorer\Advanced" -Name "DisableThumbsDBOnNetworkFolders" -ErrorAction SilentlyContinue | |
} | |
# Add secondary en-US keyboard | |
Function AddENKeyboard { | |
Write-Host "Adding secondary en-US keyboard..." | |
$langs = Get-WinUserLanguageList | |
$langs.Add("en-US") | |
Set-WinUserLanguageList $langs -Force | |
} | |
# Remove secondary en-US keyboard | |
Function RemoveENKeyboard { | |
Write-Host "Removing secondary en-US keyboard..." | |
$langs = Get-WinUserLanguageList | |
Set-WinUserLanguageList ($langs | ? {$_.LanguageTag -ne "en-US"}) -Force | |
} | |
# Enable NumLock after startup | |
Function EnableNumlock { | |
Write-Host "Enabling NumLock after startup..." | |
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 | |
Add-Type -AssemblyName System.Windows.Forms | |
If (!([System.Windows.Forms.Control]::IsKeyLocked('NumLock'))) { | |
$wsh = New-Object -ComObject WScript.Shell | |
$wsh.SendKeys('{NUMLOCK}') | |
} | |
} | |
# Disable NumLock after startup | |
Function DisableNumlock { | |
Write-Host "Disabling NumLock after startup..." | |
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 2147483648 | |
Add-Type -AssemblyName System.Windows.Forms | |
If ([System.Windows.Forms.Control]::IsKeyLocked('NumLock')) { | |
$wsh = New-Object -ComObject WScript.Shell | |
$wsh.SendKeys('{NUMLOCK}') | |
} | |
} | |
########## | |
# Application Tweaks | |
########## | |
# Disable OneDrive | |
Function DisableOneDrive { | |
Write-Host "Disabling OneDrive..." | |
If (!(Test-Path "HKLM:\SOFTWARE\Policies\Microsoft\Windows\OneDrive")) { | |
New-Item -Path "HKLM:\SOFTWARE\Policies\Microsoft\Windows\OneDrive" | Out-Null | |
} | |
Set-ItemProperty -Path "HKLM:\SOFTWARE\Policies\Microsoft\Windows\OneDrive" -Name "DisableFileSyncNGSC" -Type DWord -Value 1 | |
} | |
# Enable OneDrive | |
Function EnableOneDrive { | |
Write-Host "Enabling OneDrive..." | |
Remove-ItemProperty -Path "HKLM:\SOFTWARE\Policies\Microsoft\Windows\OneDrive" -Name "DisableFileSyncNGSC" -ErrorAction SilentlyContinue | |
} | |
# Uninstall OneDrive - Not applicable to Server | |
Function UninstallOneDrive { | |
Write-Host "Uninstalling OneDrive..." | |
Stop-Process -Name OneDrive -ErrorAction SilentlyContinue | |
Start-Sleep -s 3 | |
$onedrive = "$env:SYSTEMROOT\SysWOW64\OneDriveSetup.exe" | |
If (!(Test-Path $onedrive)) { | |
$onedrive = "$env:SYSTEMROOT\System32\OneDriveSetup.exe" | |
} | |
Start-Process $onedrive "/uninstall" -NoNewWindow -Wait | |
Start-Sleep -s 3 | |
Stop-Process -Name explorer -ErrorAction SilentlyContinue | |
Start-Sleep -s 3 | |
Remove-Item -Path "$env:USERPROFILE\OneDrive" -Force -Recurse -ErrorAction SilentlyContinue | |
Remove-Item -Path "$env:LOCALAPPDATA\Microsoft\OneDrive" -Force -Recurse -ErrorAction SilentlyContinue | |
Remove-Item -Path "$env:PROGRAMDATA\Microsoft OneDrive" -Force -Recurse -ErrorAction SilentlyContinue | |
Remove-Item -Path "$env:SYSTEMDRIVE\OneDriveTemp" -Force -Recurse -ErrorAction SilentlyContinue | |
If (!(Test-Path "HKCR:")) { | |
New-PSDrive -Name HKCR -PSProvider Registry -Root HKEY_CLASSES_ROOT | Out-Null | |
} | |
Remove-Item -Path "HKCR:\CLSID\{018D5C66-4533-4307-9B53-224DE2ED1FE6}" -Recurse -ErrorAction SilentlyContinue | |
Remove-Item -Path "HKCR:\Wow6432Node\CLSID\{018D5C66-4533-4307-9B53-224DE2ED1FE6}" -Recurse -ErrorAction SilentlyContinue | |
} | |
# Install OneDrive - Not applicable to Server | |
Function InstallOneDrive { | |
Write-Host "Installing OneDrive..." | |
$onedrive = "$env:SYSTEMROOT\SysWOW64\OneDriveSetup.exe" | |
If (!(Test-Path $onedrive)) { | |
$onedrive = "$env:SYSTEMROOT\System32\OneDriveSetup.exe" | |
} | |
Start-Process $onedrive -NoNewWindow | |
} | |
# Uninstall default Microsoft applications | |
Function UninstallMsftBloat { | |
Write-Host "Uninstalling default Microsoft applications..." | |
Get-AppxPackage "Microsoft.3DBuilder" | Remove-AppxPackage | |
Get-AppxPackage "Microsoft.BingFinance" | Remove-AppxPackage | |
Get-AppxPackage "Microsoft.BingNews" | Remove-AppxPackage | |
Get-AppxPackage "Microsoft.BingSports" | Remove-AppxPackage | |
Get-AppxPackage "Microsoft.BingWeather" | Remove-AppxPackage | |
Get-AppxPackage "Microsoft.Getstarted" | Remove-AppxPackage | |
Get-AppxPackage "Microsoft.MicrosoftOfficeHub" | Remove-AppxPackage | |
Get-AppxPackage "Microsoft.MicrosoftSolitaireCollection" | Remove-AppxPackage | |
Get-AppxPackage "Microsoft.Office.OneNote" | Remove-AppxPackage | |
Get-AppxPackage "Microsoft.People" | Remove-AppxPackage | |
Get-AppxPackage "Microsoft.SkypeApp" | Remove-AppxPackage | |
Get-AppxPackage "Microsoft.Windows.Photos" | Remove-AppxPackage | |
Get-AppxPackage "Microsoft.WindowsAlarms" | Remove-AppxPackage | |
Get-AppxPackage "Microsoft.WindowsCamera" | Remove-AppxPackage | |
Get-AppxPackage "microsoft.windowscommunicationsapps" | Remove-AppxPackage | |
Get-AppxPackage "Microsoft.WindowsMaps" | Remove-AppxPackage | |
Get-AppxPackage "Microsoft.WindowsPhone" | Remove-AppxPackage | |
Get-AppxPackage "Microsoft.WindowsSoundRecorder" | Remove-AppxPackage | |
Get-AppxPackage "Microsoft.ZuneMusic" | Remove-AppxPackage | |
Get-AppxPackage "Microsoft.ZuneVideo" | Remove-AppxPackage | |
Get-AppxPackage "Microsoft.AppConnector" | Remove-AppxPackage | |
Get-AppxPackage "Microsoft.ConnectivityStore" | Remove-AppxPackage | |
Get-AppxPackage "Microsoft.Office.Sway" | Remove-AppxPackage | |
Get-AppxPackage "Microsoft.Messaging" | Remove-AppxPackage | |
Get-AppxPackage "Microsoft.CommsPhone" | Remove-AppxPackage | |
Get-AppxPackage "Microsoft.MicrosoftStickyNotes" | Remove-AppxPackage | |
Get-AppxPackage "Microsoft.OneConnect" | Remove-AppxPackage | |
Get-AppxPackage "Microsoft.WindowsFeedbackHub" | Remove-AppxPackage | |
Get-AppxPackage "Microsoft.MinecraftUWP" | Remove-AppxPackage | |
Get-AppxPackage "Microsoft.MicrosoftPowerBIForWindows" | Remove-AppxPackage | |
Get-AppxPackage "Microsoft.NetworkSpeedTest" | Remove-AppxPackage | |
Get-AppxPackage "Microsoft.MSPaint" | Remove-AppxPackage | |
Get-AppxPackage "Microsoft.Microsoft3DViewer" | Remove-AppxPackage | |
Get-AppxPackage "Microsoft.RemoteDesktop" | Remove-AppxPackage | |
Get-AppxPackage "Microsoft.Print3D" | Remove-AppxPackage | |
} | |
# Install default Microsoft applications | |
Function InstallMsftBloat { | |
Write-Host "Installing default Microsoft applications..." | |
Get-AppxPackage -AllUsers "Microsoft.3DBuilder" | ForEach {Add-AppxPackage -DisableDevelopmentMode -Register "$($_.InstallLocation)\AppXManifest.xml"} | |
Get-AppxPackage -AllUsers "Microsoft.BingFinance" | ForEach {Add-AppxPackage -DisableDevelopmentMode -Register "$($_.InstallLocation)\AppXManifest.xml"} | |
Get-AppxPackage -AllUsers "Microsoft.BingNews" | ForEach {Add-AppxPackage -DisableDevelopmentMode -Register "$($_.InstallLocation)\AppXManifest.xml"} | |
Get-AppxPackage -AllUsers "Microsoft.BingSports" | ForEach {Add-AppxPackage -DisableDevelopmentMode -Register "$($_.InstallLocation)\AppXManifest.xml"} | |
Get-AppxPackage -AllUsers "Microsoft.BingWeather" | ForEach {Add-AppxPackage -DisableDevelopmentMode -Register "$($_.InstallLocation)\AppXManifest.xml"} | |
Get-AppxPackage -AllUsers "Microsoft.Getstarted" | ForEach {Add-AppxPackage -DisableDevelopmentMode -Register "$($_.InstallLocation)\AppXManifest.xml"} | |
Get-AppxPackage -AllUsers "Microsoft.MicrosoftOfficeHub" | ForEach {Add-AppxPackage -DisableDevelopmentMode -Register "$($_.InstallLocation)\AppXManifest.xml"} | |
Get-AppxPackage -AllUsers "Microsoft.MicrosoftSolitaireCollection" | ForEach {Add-AppxPackage -DisableDevelopmentMode -Register "$($_.InstallLocation)\AppXManifest.xml"} | |
Get-AppxPackage -AllUsers "Microsoft.Office.OneNote" | ForEach {Add-AppxPackage -DisableDevelopmentMode -Register "$($_.InstallLocation)\AppXManifest.xml"} | |
Get-AppxPackage -AllUsers "Microsoft.People" | ForEach {Add-AppxPackage -DisableDevelopmentMode -Register "$($_.InstallLocation)\AppXManifest.xml"} | |
Get-AppxPackage -AllUsers "Microsoft.SkypeApp" | ForEach {Add-AppxPackage -DisableDevelopmentMode -Register "$($_.InstallLocation)\AppXManifest.xml"} | |
Get-AppxPackage -AllUsers "Microsoft.Windows.Photos" | ForEach {Add-AppxPackage -DisableDevelopmentMode -Register "$($_.InstallLocation)\AppXManifest.xml"} | |
Get-AppxPackage -AllUsers "Microsoft.WindowsAlarms" | ForEach {Add-AppxPackage -DisableDevelopmentMode -Register "$($_.InstallLocation)\AppXManifest.xml"} | |
Get-AppxPackage -AllUsers "Microsoft.WindowsCamera" | ForEach {Add-AppxPackage -DisableDevelopmentMode -Register "$($_.InstallLocation)\AppXManifest.xml"} | |
Get-AppxPackage -AllUsers "Microsoft.windowscommunicationsapps" | ForEach {Add-AppxPackage -DisableDevelopmentMode -Register "$($_.InstallLocation)\AppXManifest.xml"} | |
Get-AppxPackage -AllUsers "Microsoft.WindowsMaps" | ForEach {Add-AppxPackage -DisableDevelopmentMode -Register "$($_.InstallLocation)\AppXManifest.xml"} | |
Get-AppxPackage -AllUsers "Microsoft.WindowsPhone" | ForEach {Add-AppxPackage -DisableDevelopmentMode -Register "$($_.InstallLocation)\AppXManifest.xml"} | |
Get-AppxPackage -AllUsers "Microsoft.WindowsSoundRecorder" | ForEach {Add-AppxPackage -DisableDevelopmentMode -Register "$($_.InstallLocation)\AppXManifest.xml"} | |
Get-AppxPackage -AllUsers "Microsoft.ZuneMusic" | ForEach {Add-AppxPackage -DisableDevelopmentMode -Register "$($_.InstallLocation)\AppXManifest.xml"} | |
Get-AppxPackage -AllUsers "Microsoft.ZuneVideo" | ForEach {Add-AppxPackage -DisableDevelopmentMode -Register "$($_.InstallLocation)\AppXManifest.xml"} | |
Get-AppxPackage -AllUsers "Microsoft.AppConnector" | ForEach {Add-AppxPackage -DisableDevelopmentMode -Register "$($_.InstallLocation)\AppXManifest.xml"} | |
Get-AppxPackage -AllUsers "Microsoft.ConnectivityStore" | ForEach {Add-AppxPackage -DisableDevelopmentMode -Register "$($_.InstallLocation)\AppXManifest.xml"} | |
Get-AppxPackage -AllUsers "Microsoft.Office.Sway" | ForEach {Add-AppxPackage -DisableDevelopmentMode -Register "$($_.InstallLocation)\AppXManifest.xml"} | |
Get-AppxPackage -AllUsers "Microsoft.Messaging" | ForEach {Add-AppxPackage -DisableDevelopmentMode -Register "$($_.InstallLocation)\AppXManifest.xml"} | |
Get-AppxPackage -AllUsers "Microsoft.CommsPhone" | ForEach {Add-AppxPackage -DisableDevelopmentMode -Register "$($_.InstallLocation)\AppXManifest.xml"} | |
Get-AppxPackage -AllUsers "Microsoft.MicrosoftStickyNotes" | ForEach {Add-AppxPackage -DisableDevelopmentMode -Register "$($_.InstallLocation)\AppXManifest.xml"} | |
Get-AppxPackage -AllUsers "Microsoft.OneConnect" | ForEach {Add-AppxPackage -DisableDevelopmentMode -Register "$($_.InstallLocation)\AppXManifest.xml"} | |
Get-AppxPackage -AllUsers "Microsoft.WindowsFeedbackHub" | ForEach {Add-AppxPackage -DisableDevelopmentMode -Register "$($_.InstallLocation)\AppXManifest.xml"} | |
Get-AppxPackage -AllUsers "Microsoft.MinecraftUWP" | ForEach {Add-AppxPackage -DisableDevelopmentMode -Register "$($_.InstallLocation)\AppXManifest.xml"} | |
Get-AppxPackage -AllUsers "Microsoft.MicrosoftPowerBIForWindows" | ForEach {Add-AppxPackage -DisableDevelopmentMode -Register "$($_.InstallLocation)\AppXManifest.xml"} | |
Get-AppxPackage -AllUsers "Microsoft.NetworkSpeedTest" | ForEach {Add-AppxPackage -DisableDevelopmentMode -Register "$($_.InstallLocation)\AppXManifest.xml"} | |
Get-AppxPackage -AllUsers "Microsoft.MSPaint" | ForEach {Add-AppxPackage -DisableDevelopmentMode -Register "$($_.InstallLocation)\AppXManifest.xml"} | |
Get-AppxPackage -AllUsers "Microsoft.Microsoft3DViewer" | ForEach {Add-AppxPackage -DisableDevelopmentMode -Register "$($_.InstallLocation)\AppXManifest.xml"} | |
Get-AppxPackage -AllUsers "Microsoft.RemoteDesktop" | ForEach {Add-AppxPackage -DisableDevelopmentMode -Register "$($_.InstallLocation)\AppXManifest.xml"} | |
Get-AppxPackage -AllUsers "Microsoft.Print3D" | ForEach {Add-AppxPackage -DisableDevelopmentMode -Register "$($_.InstallLocation)\AppXManifest.xml"} | |
} | |
# In case you have removed them for good, you can try to restore the files using installation medium as follows | |
# New-Item C:\Mnt -Type Directory | Out-Null | |
# dism /Mount-Image /ImageFile:D:\sources\install.wim /index:1 /ReadOnly /MountDir:C:\Mnt | |
# robocopy /S /SEC /R:0 "C:\Mnt\Program Files\WindowsApps" "C:\Program Files\WindowsApps" | |
# dism /Unmount-Image /Discard /MountDir:C:\Mnt | |
# Remove-Item -Path C:\Mnt -Recurse | |
# Uninstall default third party applications | |
function UninstallThirdPartyBloat { | |
Write-Host "Uninstalling default third party applications..." | |
Get-AppxPackage "9E2F88E3.Twitter" | Remove-AppxPackage | |
Get-AppxPackage "king.com.CandyCrushSodaSaga" | Remove-AppxPackage | |
Get-AppxPackage "4DF9E0F8.Netflix" | Remove-AppxPackage | |
Get-AppxPackage "Drawboard.DrawboardPDF" | Remove-AppxPackage | |
Get-AppxPackage "D52A8D61.FarmVille2CountryEscape" | Remove-AppxPackage | |
Get-AppxPackage "GAMELOFTSA.Asphalt8Airborne" | Remove-AppxPackage | |
Get-AppxPackage "flaregamesGmbH.RoyalRevolt2" | Remove-AppxPackage | |
Get-AppxPackage "AdobeSystemsIncorporated.AdobePhotoshopExpress" | Remove-AppxPackage | |
Get-AppxPackage "ActiproSoftwareLLC.562882FEEB491" | Remove-AppxPackage | |
Get-AppxPackage "D5EA27B7.Duolingo-LearnLanguagesforFree" | Remove-AppxPackage | |
Get-AppxPackage "Facebook.Facebook" | Remove-AppxPackage | |
Get-AppxPackage "46928bounde.EclipseManager" | Remove-AppxPackage | |
Get-AppxPackage "A278AB0D.MarchofEmpires" | Remove-AppxPackage | |
Get-AppxPackage "KeeperSecurityInc.Keeper" | Remove-AppxPackage | |
Get-AppxPackage "king.com.BubbleWitch3Saga" | Remove-AppxPackage | |
Get-AppxPackage "89006A2E.AutodeskSketchBook" | Remove-AppxPackage | |
Get-AppxPackage "CAF9E577.Plex" | Remove-AppxPackage | |
Get-AppxPackage "A278AB0D.DisneyMagicKingdoms" | Remove-AppxPackage | |
Get-AppxPackage "828B5831.HiddenCityMysteryofShadows" | Remove-AppxPackage | |
Get-AppxPackage "WinZipComputing.WinZipUniversal" | Remove-AppxPackage | |
Get-AppxPackage "SpotifyAB.SpotifyMusic" | Remove-AppxPackage | |
Get-AppxPackage "PandoraMediaInc.29680B314EFC2" | Remove-AppxPackage | |
Get-AppxPackage "2414FC7A.Viber" | Remove-AppxPackage | |
Get-AppxPackage "64885BlueEdge.OneCalendar" | Remove-AppxPackage | |
Get-AppxPackage "41038Axilesoft.ACGMediaPlayer" | Remove-AppxPackage | |
} | |
# Install default third party applications | |
Function InstallThirdPartyBloat { | |
Write-Host "Installing default third party applications..." | |
Get-AppxPackage -AllUsers "9E2F88E3.Twitter" | ForEach {Add-AppxPackage -DisableDevelopmentMode -Register "$($_.InstallLocation)\AppXManifest.xml"} | |
Get-AppxPackage -AllUsers "king.com.CandyCrushSodaSaga" | ForEach {Add-AppxPackage -DisableDevelopmentMode -Register "$($_.InstallLocation)\AppXManifest.xml"} | |
Get-AppxPackage -AllUsers "4DF9E0F8.Netflix" | ForEach {Add-AppxPackage -DisableDevelopmentMode -Register "$($_.InstallLocation)\AppXManifest.xml"} | |
Get-AppxPackage -AllUsers "Drawboard.DrawboardPDF" | ForEach {Add-AppxPackage -DisableDevelopmentMode -Register "$($_.InstallLocation)\AppXManifest.xml"} | |
Get-AppxPackage -AllUsers "D52A8D61.FarmVille2CountryEscape" | ForEach {Add-AppxPackage -DisableDevelopmentMode -Register "$($_.InstallLocation)\AppXManifest.xml"} | |
Get-AppxPackage -AllUsers "GAMELOFTSA.Asphalt8Airborne" | ForEach {Add-AppxPackage -DisableDevelopmentMode -Register "$($_.InstallLocation)\AppXManifest.xml"} | |
Get-AppxPackage -AllUsers "flaregamesGmbH.RoyalRevolt2" | ForEach {Add-AppxPackage -DisableDevelopmentMode -Register "$($_.InstallLocation)\AppXManifest.xml"} | |
Get-AppxPackage -AllUsers "AdobeSystemsIncorporated.AdobePhotoshopExpress" | ForEach {Add-AppxPackage -DisableDevelopmentMode -Register "$($_.InstallLocation)\AppXManifest.xml"} | |
Get-AppxPackage -AllUsers "ActiproSoftwareLLC.562882FEEB491" | ForEach {Add-AppxPackage -DisableDevelopmentMode -Register "$($_.InstallLocation)\AppXManifest.xml"} | |
Get-AppxPackage -AllUsers "D5EA27B7.Duolingo-LearnLanguagesforFree" | ForEach {Add-AppxPackage -DisableDevelopmentMode -Register "$($_.InstallLocation)\AppXManifest.xml"} | |
Get-AppxPackage -AllUsers "Facebook.Facebook" | ForEach {Add-AppxPackage -DisableDevelopmentMode -Register "$($_.InstallLocation)\AppXManifest.xml"} | |
Get-AppxPackage -AllUsers "46928bounde.EclipseManager" | ForEach {Add-AppxPackage -DisableDevelopmentMode -Register "$($_.InstallLocation)\AppXManifest.xml"} | |
Get-AppxPackage -AllUsers "A278AB0D.MarchofEmpires" | ForEach {Add-AppxPackage -DisableDevelopmentMode -Register "$($_.InstallLocation)\AppXManifest.xml"} | |
Get-AppxPackage -AllUsers "KeeperSecurityInc.Keeper" | ForEach {Add-AppxPackage -DisableDevelopmentMode -Register "$($_.InstallLocation)\AppXManifest.xml"} | |
Get-AppxPackage -AllUsers "king.com.BubbleWitch3Saga" | ForEach {Add-AppxPackage -DisableDevelopmentMode -Register "$($_.InstallLocation)\AppXManifest.xml"} | |
Get-AppxPackage -AllUsers "89006A2E.AutodeskSketchBook" | ForEach {Add-AppxPackage -DisableDevelopmentMode -Register "$($_.InstallLocation)\AppXManifest.xml"} | |
Get-AppxPackage -AllUsers "CAF9E577.Plex" | ForEach {Add-AppxPackage -DisableDevelopmentMode -Register "$($_.InstallLocation)\AppXManifest.xml"} | |
Get-AppxPackage -AllUsers "A278AB0D.DisneyMagicKingdoms" | ForEach {Add-AppxPackage -DisableDevelopmentMode -Register "$($_.InstallLocation)\AppXManifest.xml"} | |
Get-AppxPackage -AllUsers "828B5831.HiddenCityMysteryofShadows" | ForEach {Add-AppxPackage -DisableDevelopmentMode -Register "$($_.InstallLocation)\AppXManifest.xml"} | |
Get-AppxPackage -AllUsers "WinZipComputing.WinZipUniversal" | ForEach {Add-AppxPackage -DisableDevelopmentMode -Register "$($_.InstallLocation)\AppXManifest.xml"} | |
Get-AppxPackage -AllUsers "SpotifyAB.SpotifyMusic" | ForEach {Add-AppxPackage -DisableDevelopmentMode -Register "$($_.InstallLocation)\AppXManifest.xml"} | |
Get-AppxPackage -AllUsers "PandoraMediaInc.29680B314EFC2" | ForEach {Add-AppxPackage -DisableDevelopmentMode -Register "$($_.InstallLocation)\AppXManifest.xml"} | |
Get-AppxPackage -AllUsers "2414FC7A.Viber" | ForEach {Add-AppxPackage -DisableDevelopmentMode -Register "$($_.InstallLocation)\AppXManifest.xml"} | |
Get-AppxPackage -AllUsers "64885BlueEdge.OneCalendar" | ForEach {Add-AppxPackage -DisableDevelopmentMode -Register "$($_.InstallLocation)\AppXManifest.xml"} | |
Get-AppxPackage -AllUsers "41038Axilesoft.ACGMediaPlayer" | ForEach {Add-AppxPackage -DisableDevelopmentMode -Register "$($_.InstallLocation)\AppXManifest.xml"} | |
} | |
# Uninstall Windows Store | |
Function UninstallWindowsStore { | |
Write-Host "Uninstalling Windows Store..." | |
Get-AppxPackage "Microsoft.DesktopAppInstaller" | Remove-AppxPackage | |
Get-AppxPackage "Microsoft.WindowsStore" | Remove-AppxPackage | |
} | |
# Install Windows Store | |
Function InstallWindowsStore { | |
Write-Host "Installing Windows Store..." | |
Get-AppxPackage -AllUsers "Microsoft.DesktopAppInstaller" | ForEach {Add-AppxPackage -DisableDevelopmentMode -Register "$($_.InstallLocation)\AppXManifest.xml"} | |
Get-AppxPackage -AllUsers "Microsoft.WindowsStore" | ForEach {Add-AppxPackage -DisableDevelopmentMode -Register "$($_.InstallLocation)\AppXManifest.xml"} | |
} | |
# Disable Xbox features | |
Function DisableXboxFeatures { | |
Write-Host "Disabling Xbox features..." | |
Get-AppxPackage "Microsoft.XboxApp" | Remove-AppxPackage | |
Get-AppxPackage "Microsoft.XboxIdentityProvider" | Remove-AppxPackage | |
Get-AppxPackage "Microsoft.XboxSpeechToTextOverlay" | Remove-AppxPackage | |
Get-AppxPackage "Microsoft.XboxGameOverlay" | Remove-AppxPackage | |
Get-AppxPackage "Microsoft.Xbox.TCUI" | Remove-AppxPackage | |
Set-ItemProperty -Path "HKCU:\System\GameConfigStore" -Name "GameDVR_Enabled" -Type DWord -Value 0 | |
If (!(Test-Path "HKLM:\SOFTWARE\Policies\Microsoft\Windows\GameDVR")) { | |
New-Item -Path "HKLM:\SOFTWARE\Policies\Microsoft\Windows\GameDVR" | Out-Null | |
} | |
Set-ItemProperty -Path "HKLM:\SOFTWARE\Policies\Microsoft\Windows\GameDVR" -Name "AllowGameDVR" -Type DWord -Value 0 | |
} | |
# Enable Xbox features | |
Function EnableXboxFeatures { | |
Write-Host "Enabling Xbox features..." | |
Get-AppxPackage -AllUsers "Microsoft.XboxApp" | ForEach {Add-AppxPackage -DisableDevelopmentMode -Register "$($_.InstallLocation)\AppXManifest.xml"} | |
Get-AppxPackage -AllUsers "Microsoft.XboxIdentityProvider" | ForEach {Add-AppxPackage -DisableDevelopmentMode -Register "$($_.InstallLocation)\AppXManifest.xml"} | |
Get-AppxPackage -AllUsers "Microsoft.XboxSpeechToTextOverlay" | ForEach {Add-AppxPackage -DisableDevelopmentMode -Register "$($_.InstallLocation)\AppXManifest.xml"} | |
Get-AppxPackage -AllUsers "Microsoft.XboxGameOverlay" | ForEach {Add-AppxPackage -DisableDevelopmentMode -Register "$($_.InstallLocation)\AppXManifest.xml"} | |
Get-AppxPackage -AllUsers "Microsoft.Xbox.TCUI" | ForEach {Add-AppxPackage -DisableDevelopmentMode -Register "$($_.InstallLocation)\AppXManifest.xml"} | |
Set-ItemProperty -Path "HKCU:\System\GameConfigStore" -Name "GameDVR_Enabled" -Type DWord -Value 1 | |
Remove-ItemProperty -Path "HKLM:\SOFTWARE\Policies\Microsoft\Windows\GameDVR" -Name "AllowGameDVR" -ErrorAction SilentlyContinue | |
} | |
# Disable built-in Adobe Flash in IE and Edge | |
Function DisableAdobeFlash { | |
Write-Host "Disabling built-in Adobe Flash in IE and Edge..." | |
If (!(Test-Path "HKCU:\Software\Classes\Local Settings\Software\Microsoft\Windows\CurrentVersion\AppContainer\Storage\microsoft.microsoftedge_8wekyb3d8bbwe\MicrosoftEdge\Addons")) { | |
New-Item -Path "HKCU:\Software\Classes\Local Settings\Software\Microsoft\Windows\CurrentVersion\AppContainer\Storage\microsoft.microsoftedge_8wekyb3d8bbwe\MicrosoftEdge\Addons" -Force | Out-Null | |
} | |
Set-ItemProperty -Path "HKCU:\Software\Classes\Local Settings\Software\Microsoft\Windows\CurrentVersion\AppContainer\Storage\microsoft.microsoftedge_8wekyb3d8bbwe\MicrosoftEdge\Addons" -Name "FlashPlayerEnabled" -Type DWord -Value 0 | |
If (!(Test-Path "HKCU:\Software\Microsoft\Windows\CurrentVersion\Ext\Settings\{D27CDB6E-AE6D-11CF-96B8-444553540000}")) { | |
New-Item -Path "HKCU:\Software\Microsoft\Windows\CurrentVersion\Ext\Settings\{D27CDB6E-AE6D-11CF-96B8-444553540000}" -Force | Out-Null | |
} | |
Set-ItemProperty -Path "HKCU:\Software\Microsoft\Windows\CurrentVersion\Ext\Settings\{D27CDB6E-AE6D-11CF-96B8-444553540000}" -Name "Flags" -Type DWord -Value 1 | |
} | |
# Enable built-in Adobe Flash in IE and Edge | |
Function EnableAdobeFlash { | |
Write-Host "Enabling built-in Adobe Flash in IE and Edge..." | |
Remove-ItemProperty -Path "HKCU:\Software\Classes\Local Settings\Software\Microsoft\Windows\CurrentVersion\AppContainer\Storage\microsoft.microsoftedge_8wekyb3d8bbwe\MicrosoftEdge\Addons" -Name "FlashPlayerEnabled" -ErrorAction SilentlyContinue | |
Remove-ItemProperty -Path "HKCU:\Software\Microsoft\Windows\CurrentVersion\Ext\Settings\{D27CDB6E-AE6D-11CF-96B8-444553540000}" -Name "Flags" -ErrorAction SilentlyContinue | |
} | |
# Uninstall Windows Media Player | |
Function UninstallMediaPlayer { | |
Write-Host "Uninstalling Windows Media Player..." | |
Disable-WindowsOptionalFeature -Online -FeatureName "WindowsMediaPlayer" -NoRestart -WarningAction SilentlyContinue | Out-Null | |
} | |
# Install Windows Media Player | |
Function InstallMediaPlayer { | |
Write-Host "Installing Windows Media Player..." | |
Enable-WindowsOptionalFeature -Online -FeatureName "WindowsMediaPlayer" -NoRestart -WarningAction SilentlyContinue | Out-Null | |
} | |
# Uninstall Work Folders Client - Not applicable to Server | |
Function UninstallWorkFolders { | |
Write-Host "Uninstalling Work Folders Client..." | |
Disable-WindowsOptionalFeature -Online -FeatureName "WorkFolders-Client" -NoRestart -WarningAction SilentlyContinue | Out-Null | |
} | |
# Install Work Folders Client - Not applicable to Server | |
Function InstallWorkFolders { | |
Write-Host "Installing Work Folders Client..." | |
Enable-WindowsOptionalFeature -Online -FeatureName "WorkFolders-Client" -NoRestart -WarningAction SilentlyContinue | Out-Null | |
} | |
# Install Linux Subsystem - Applicable to 1607 or newer, not applicable to Server yet | |
Function InstallLinuxSubsystem { | |
Write-Host "Installing Linux Subsystem..." | |
Set-ItemProperty -Path "HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\AppModelUnlock" -Name "AllowDevelopmentWithoutDevLicense" -Type DWord -Value 1 | |
Set-ItemProperty -Path "HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\AppModelUnlock" -Name "AllowAllTrustedApps" -Type DWord -Value 1 | |
Enable-WindowsOptionalFeature -Online -FeatureName "Microsoft-Windows-Subsystem-Linux" -NoRestart -WarningAction SilentlyContinue | Out-Null | |
} | |
# Uninstall Linux Subsystem - Applicable to 1607 or newer, not applicable to Server yet | |
Function UninstallLinuxSubsystem { | |
Write-Host "Uninstalling Linux Subsystem..." | |
Set-ItemProperty -Path "HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\AppModelUnlock" -Name "AllowDevelopmentWithoutDevLicense" -Type DWord -Value 0 | |
Set-ItemProperty -Path "HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\AppModelUnlock" -Name "AllowAllTrustedApps" -Type DWord -Value 0 | |
Disable-WindowsOptionalFeature -Online -FeatureName "Microsoft-Windows-Subsystem-Linux" -NoRestart -WarningAction SilentlyContinue | Out-Null | |
} | |
# Install Hyper-V - Not applicable to Home | |
Function InstallHyperV { | |
Write-Host "Installing Hyper-V..." | |
If ((Get-WmiObject -Class "Win32_OperatingSystem").Caption -like "*Server*") { | |
Install-WindowsFeature -Name "Hyper-V" -IncludeManagementTools -WarningAction SilentlyContinue | Out-Null | |
} | |
Else { | |
Enable-WindowsOptionalFeature -Online -FeatureName "Microsoft-Hyper-V-All" -NoRestart -WarningAction SilentlyContinue | Out-Null | |
} | |
} | |
# Uninstall Hyper-V - Not applicable to Home | |
Function UninstallHyperV { | |
Write-Host "Uninstalling Hyper-V..." | |
If ((Get-WmiObject -Class "Win32_OperatingSystem").Caption -like "*Server*") { | |
Uninstall-WindowsFeature -Name "Hyper-V" -IncludeManagementTools -WarningAction SilentlyContinue | Out-Null | |
} | |
Else { | |
Disable-WindowsOptionalFeature -Online -FeatureName "Microsoft-Hyper-V-All" -NoRestart -WarningAction SilentlyContinue | Out-Null | |
} | |
} | |
# Set Photo Viewer association for bmp, gif, jpg, png and tif | |
Function SetPhotoViewerAssociation { | |
Write-Host "Setting Photo Viewer association for bmp, gif, jpg, png and tif..." | |
If (!(Test-Path "HKCR:")) { | |
New-PSDrive -Name HKCR -PSProvider Registry -Root HKEY_CLASSES_ROOT | Out-Null | |
} | |
ForEach ($type in @("Paint.Picture", "giffile", "jpegfile", "pngfile")) { | |
New-Item -Path $("HKCR:\$type\shell\open") -Force | Out-Null | |
New-Item -Path $("HKCR:\$type\shell\open\command") | Out-Null | |
Set-ItemProperty -Path $("HKCR:\$type\shell\open") -Name "MuiVerb" -Type ExpandString -Value "@%ProgramFiles%\Windows Photo Viewer\photoviewer.dll,-3043" | |
Set-ItemProperty -Path $("HKCR:\$type\shell\open\command") -Name "(Default)" -Type ExpandString -Value "%SystemRoot%\System32\rundll32.exe `"%ProgramFiles%\Windows Photo Viewer\PhotoViewer.dll`", ImageView_Fullscreen %1" | |
} | |
} | |
# Unset Photo Viewer association for bmp, gif, jpg, png and tif | |
Function UnsetPhotoViewerAssociation { | |
Write-Host "Unsetting Photo Viewer association for bmp, gif, jpg, png and tif..." | |
If (!(Test-Path "HKCR:")) { | |
New-PSDrive -Name HKCR -PSProvider Registry -Root HKEY_CLASSES_ROOT | Out-Null | |
} | |
Remove-Item -Path "HKCR:\Paint.Picture\shell\open" -Recurse -ErrorAction SilentlyContinue | |
Remove-ItemProperty -Path "HKCR:\giffile\shell\open" -Name "MuiVerb" -ErrorAction SilentlyContinue | |
Set-ItemProperty -Path "HKCR:\giffile\shell\open" -Name "CommandId" -Type String -Value "IE.File" | |
Set-ItemProperty -Path "HKCR:\giffile\shell\open\command" -Name "(Default)" -Type String -Value "`"$env:SystemDrive\Program Files\Internet Explorer\iexplore.exe`" %1" | |
Set-ItemProperty -Path "HKCR:\giffile\shell\open\command" -Name "DelegateExecute" -Type String -Value "{17FE9752-0B5A-4665-84CD-569794602F5C}" | |
Remove-Item -Path "HKCR:\jpegfile\shell\open" -Recurse -ErrorAction SilentlyContinue | |
Remove-Item -Path "HKCR:\pngfile\shell\open" -Recurse -ErrorAction SilentlyContinue | |
} | |
# Add Photo Viewer to "Open with..." | |
Function AddPhotoViewerOpenWith { | |
Write-Host "Adding Photo Viewer to `"Open with...`"" | |
If (!(Test-Path "HKCR:")) { | |
New-PSDrive -Name HKCR -PSProvider Registry -Root HKEY_CLASSES_ROOT | Out-Null | |
} | |
New-Item -Path "HKCR:\Applications\photoviewer.dll\shell\open\command" -Force | Out-Null | |
New-Item -Path "HKCR:\Applications\photoviewer.dll\shell\open\DropTarget" -Force | Out-Null | |
Set-ItemProperty -Path "HKCR:\Applications\photoviewer.dll\shell\open" -Name "MuiVerb" -Type String -Value "@photoviewer.dll,-3043" | |
Set-ItemProperty -Path "HKCR:\Applications\photoviewer.dll\shell\open\command" -Name "(Default)" -Type ExpandString -Value "%SystemRoot%\System32\rundll32.exe `"%ProgramFiles%\Windows Photo Viewer\PhotoViewer.dll`", ImageView_Fullscreen %1" | |
Set-ItemProperty -Path "HKCR:\Applications\photoviewer.dll\shell\open\DropTarget" -Name "Clsid" -Type String -Value "{FFE2A43C-56B9-4bf5-9A79-CC6D4285608A}" | |
} | |
# Remove Photo Viewer from "Open with..." | |
Function RemovePhotoViewerOpenWith { | |
Write-Host "Removing Photo Viewer from `"Open with...`"" | |
If (!(Test-Path "HKCR:")) { | |
New-PSDrive -Name HKCR -PSProvider Registry -Root HKEY_CLASSES_ROOT | Out-Null | |
} | |
Remove-Item -Path "HKCR:\Applications\photoviewer.dll\shell\open" -Recurse -ErrorAction SilentlyContinue | |
} | |
# Disable search for app in store for unknown extensions | |
Function DisableSearchAppInStore { | |
Write-Host "Disabling search for app in store for unknown extensions..." | |
If (!(Test-Path "HKLM:\SOFTWARE\Policies\Microsoft\Windows\Explorer")) { | |
New-Item -Path "HKLM:\SOFTWARE\Policies\Microsoft\Windows\Explorer" | Out-Null | |
} | |
Set-ItemProperty -Path "HKLM:\SOFTWARE\Policies\Microsoft\Windows\Explorer" -Name "NoUseStoreOpenWith" -Type DWord -Value 1 | |
} | |
# Enable search for app in store for unknown extensions | |
Function EnableSearchAppInStore { | |
Write-Host "Enabling search for app in store for unknown extensions..." | |
Remove-ItemProperty -Path "HKLM:\SOFTWARE\Policies\Microsoft\Windows\Explorer" -Name "NoUseStoreOpenWith" -ErrorAction SilentlyContinue | |
} | |
# Disable 'How do you want to open this file?' prompt | |
Function DisableNewAppPrompt { | |
Write-Host "Disabling 'How do you want to open this file?' prompt..." | |
If (!(Test-Path "HKLM:\SOFTWARE\Policies\Microsoft\Windows\Explorer")) { | |
New-Item -Path "HKLM:\SOFTWARE\Policies\Microsoft\Windows\Explorer" | Out-Null | |
} | |
Set-ItemProperty -Path "HKLM:\SOFTWARE\Policies\Microsoft\Windows\Explorer" -Name "NoNewAppAlert" -Type DWord -Value 1 | |
} | |
# Enable 'How do you want to open this file?' prompt | |
Function EnableNewAppPrompt { | |
Write-Host "Enabling 'How do you want to open this file?' prompt..." | |
Remove-ItemProperty -Path "HKLM:\SOFTWARE\Policies\Microsoft\Windows\Explorer" -Name "NoNewAppAlert" -ErrorAction SilentlyContinue | |
} | |
# Enable F8 boot menu options | |
Function EnableF8BootMenu { | |
Write-Host "Enabling F8 boot menu options..." | |
bcdedit /set `{current`} bootmenupolicy Legacy | Out-Null | |
} | |
# Disable F8 boot menu options | |
Function DisableF8BootMenu { | |
Write-Host "Disabling F8 boot menu options..." | |
bcdedit /set `{current`} bootmenupolicy Standard | Out-Null | |
} | |
# Set Data Execution Prevention (DEP) policy to OptOut | |
Function SetDEPOptOut { | |
Write-Host "Setting Data Execution Prevention (DEP) policy to OptOut..." | |
bcdedit /set `{current`} nx OptOut | Out-Null | |
} | |
# Set Data Execution Prevention (DEP) policy to OptIn | |
Function SetDEPOptIn { | |
Write-Host "Setting Data Execution Prevention (DEP) policy to OptIn..." | |
bcdedit /set `{current`} nx OptIn | Out-Null | |
} | |
# Enable Meltdown (CVE-2017-5754) compatibility flag - Required for January 2018 and all subsequent Windows updates | |
# This flag is normally automatically enabled by compatible antivirus software (such as Windows Defender). | |
# Use the tweak only if you have confirmed that your AV is compatible but unable to set the flag automatically or if you don't use any AV at all. | |
# See https://support.microsoft.com/en-us/help/4072699/january-3-2018-windows-security-updates-and-antivirus-software for details. | |
Function EnableMeltdownCompatFlag { | |
Write-Host "Enabling Meltdown (CVE-2017-5754) compatibility flag..." | |
If (!(Test-Path "HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\QualityCompat")) { | |
New-Item -Path "HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\QualityCompat" | Out-Null | |
} | |
Set-ItemProperty -Path "HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\QualityCompat" -Name "cadca5fe-87d3-4b96-b7fb-a231484277cc" -Type DWord -Value 0 | |
} | |
# Disable Meltdown (CVE-2017-5754) compatibility flag | |
Function DisableMeltdownCompatFlag { | |
Write-Host "Disabling Meltdown (CVE-2017-5754) compatibility flag..." | |
Remove-ItemProperty -Path "HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\QualityCompat" -Name "cadca5fe-87d3-4b96-b7fb-a231484277cc" -ErrorAction SilentlyContinue | |
} | |
########## | |
# Server specific Tweaks | |
########## | |
# Hide Server Manager after login | |
Function HideServerManagerOnLogin { | |
Write-Host "Hiding Server Manager after login..." | |
If (!(Test-Path "HKLM:\SOFTWARE\Policies\Microsoft\Windows\Server\ServerManager")) { | |
New-Item -Path "HKLM:\SOFTWARE\Policies\Microsoft\Windows\Server\ServerManager" -Force | Out-Null | |
} | |
Set-ItemProperty -Path "HKLM:\SOFTWARE\Policies\Microsoft\Windows\Server\ServerManager" -Name "DoNotOpenAtLogon" -Type DWord -Value 1 | |
} | |
# Hide Server Manager after login | |
Function ShowServerManagerOnLogin { | |
Write-Host "Showing Server Manager after login..." | |
Remove-ItemProperty -Path "HKLM:\SOFTWARE\Policies\Microsoft\Windows\Server\ServerManager" -Name "DoNotOpenAtLogon" -ErrorAction SilentlyContinue | |
} | |
# Disable Shutdown Event Tracker | |
Function DisableShutdownTracker { | |
Write-Host "Disabling Shutdown Event Tracker..." | |
If (!(Test-Path "HKLM:\SOFTWARE\Policies\Microsoft\Windows NT\Reliability")) { | |
New-Item -Path "HKLM:\SOFTWARE\Policies\Microsoft\Windows NT\Reliability" -Force | Out-Null | |
} | |
Set-ItemProperty -Path "HKLM:\SOFTWARE\Policies\Microsoft\Windows NT\Reliability" -Name "ShutdownReasonOn" -Type DWord -Value 0 | |
} | |
# Enable Shutdown Event Tracker | |
Function EnableShutdownTracker { | |
Write-Host "Enabling Shutdown Event Tracker..." | |
Remove-ItemProperty -Path "HKLM:\SOFTWARE\Policies\Microsoft\Windows NT\Reliability" -Name "ShutdownReasonOn" -ErrorAction SilentlyContinue | |
} | |
# Disable password complexity and maximum age requirements | |
Function DisablePasswordPolicy { | |
Write-Host "Disabling password complexity and maximum age requirements..." | |
$tmpfile = New-TemporaryFile | |
secedit /export /cfg $tmpfile /quiet | |
(Get-Content $tmpfile).Replace("PasswordComplexity = 1", "PasswordComplexity = 0").Replace("MaximumPasswordAge = 42", "MaximumPasswordAge = -1") | Out-File $tmpfile | |
secedit /configure /db "$env:SYSTEMROOT\security\database\local.sdb" /cfg $tmpfile /areas SECURITYPOLICY | Out-Null | |
Remove-Item -Path $tmpfile | |
} | |
# Enable password complexity and maximum age requirements | |
Function EnablePasswordPolicy { | |
Write-Host "Enabling password complexity and maximum age requirements..." | |
$tmpfile = New-TemporaryFile | |
secedit /export /cfg $tmpfile /quiet | |
(Get-Content $tmpfile).Replace("PasswordComplexity = 0", "PasswordComplexity = 1").Replace("MaximumPasswordAge = -1", "MaximumPasswordAge = 42") | Out-File $tmpfile | |
secedit /configure /db "$env:SYSTEMROOT\security\database\local.sdb" /cfg $tmpfile /areas SECURITYPOLICY | Out-Null | |
Remove-Item -Path $tmpfile | |
} | |
# Disable Ctrl+Alt+Del requirement before login | |
Function DisableCtrlAltDelLogin { | |
Write-Host "Disabling Ctrl+Alt+Del requirement before login..." | |
Set-ItemProperty -Path "HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\Policies\System" -Name "DisableCAD" -Type DWord -Value 1 | |
} | |
# Enable Ctrl+Alt+Del requirement before login | |
Function EnableCtrlAltDelLogin { | |
Write-Host "Enabling Ctrl+Alt+Del requirement before login..." | |
Set-ItemProperty -Path "HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\Policies\System" -Name "DisableCAD" -Type DWord -Value 0 | |
} | |
# Disable Internet Explorer Enhanced Security Configuration (IE ESC) | |
Function DisableIEEnhancedSecurity { | |
Write-Host "Disabling Internet Explorer Enhanced Security Configuration (IE ESC)..." | |
Set-ItemProperty -Path "HKLM:\SOFTWARE\Microsoft\Active Setup\Installed Components\{A509B1A7-37EF-4b3f-8CFC-4F3A74704073}" -Name "IsInstalled" -Type DWord -Value 0 | |
Set-ItemProperty -Path "HKLM:\SOFTWARE\Microsoft\Active Setup\Installed Components\{A509B1A8-37EF-4b3f-8CFC-4F3A74704073}" -Name "IsInstalled" -Type DWord -Value 0 | |
} | |
# Enable Internet Explorer Enhanced Security Configuration (IE ESC) | |
Function EnableIEEnhancedSecurity { | |
Write-Host "Enabling Internet Explorer Enhanced Security Configuration (IE ESC)..." | |
Set-ItemProperty -Path "HKLM:\SOFTWARE\Microsoft\Active Setup\Installed Components\{A509B1A7-37EF-4b3f-8CFC-4F3A74704073}" -Name "IsInstalled" -Type DWord -Value 1 | |
Set-ItemProperty -Path "HKLM:\SOFTWARE\Microsoft\Active Setup\Installed Components\{A509B1A8-37EF-4b3f-8CFC-4F3A74704073}" -Name "IsInstalled" -Type DWord -Value 1 | |
} | |
########## | |
# Unpinning | |
########## | |
# Unpin all Start Menu tiles - Not applicable to Server - Note: This function has no counterpart. You have to pin the tiles back manually. | |
Function UnpinStartMenuTiles { | |
Write-Host "Unpinning all Start Menu tiles..." | |
Get-ChildItem -Path "HKCU:\Software\Microsoft\Windows\CurrentVersion\CloudStore\Store\Cache\DefaultAccount" -Include "*.group" -Recurse | ForEach-Object { | |
$data = (Get-ItemProperty -Path "$($_.PsPath)\Current" -Name "Data").Data -Join "," | |
$data = $data.Substring(0, $data.IndexOf(",0,202,30") + 9) + ",0,202,80,0,0" | |
Set-ItemProperty -Path "$($_.PsPath)\Current" -Name "Data" -Type Binary -Value $data.Split(",") | |
} | |
} | |
# Unpin all Taskbar icons - Note: This function has no counterpart. You have to pin the icons back manually. | |
Function UnpinTaskbarIcons { | |
Write-Host "Unpinning all Taskbar icons..." | |
Set-ItemProperty -Path "HKCU:\Software\Microsoft\Windows\CurrentVersion\Explorer\Taskband" -Name "Favorites" -Type Binary -Value ([byte[]](0xFF)) | |
Remove-ItemProperty -Path "HKCU:\Software\Microsoft\Windows\CurrentVersion\Explorer\Taskband" -Name "FavoritesResolve" -ErrorAction SilentlyContinue | |
} | |
# Remove default printers | |
Function RemoveDefaultPrinters { | |
Remove-Printer -Name "Microsoft XPS Document Writer" -ErrorAction:SilentlyContinue | |
Remove-Printer -Name "Microsoft Print to PDF" -ErrorAction:SilentlyContinue | |
Remove-Printer -Name "Fax" -ErrorAction:SilentlyContinue | |
} | |
$tweaks = @() | |
try { | |
$tweaks = $Configuration | ConvertFrom-Json | |
} | |
catch { | |
throw 'Unable to load configuration file!' | |
} | |
if ($tweaks.count -gt 0) { | |
$RunTweaks = Read-Choice -Message "Continue with the execution of $($tweaks.count) system configuration tweaks?" -Choices @('&Yes','&No') | |
if ($RunTweaks -eq 0) { | |
# Call the desired tweak functions | |
$tweaks | ForEach-Object { | |
Invoke-Expression $_ | |
} | |
} | |
} | |
# Need this to download via Invoke-WebRequest | |
[Net.ServicePointManager]::SecurityProtocol = [System.Security.Authentication.SslProtocols] "tls, tls11, tls12" | |
# Trust the psgallery for installs | |
Write-Host -ForegroundColor 'Yellow' 'Setting PSGallery as a trusted installation source...' | |
Set-PSRepository -Name PSGallery -InstallationPolicy Trusted | |
# Install/Update PowershellGet and PackageManager if needed | |
try { | |
Import-Module PowerShellGet | |
} | |
catch { | |
throw 'Unable to load PowerShellGet!' | |
} | |
# Need to set Nuget as a provider before installing modules via PowerShellGet | |
$null = Install-PackageProvider NuGet -Force | |
# Store a few things for later use | |
$SpecialPaths = Get-SpecialPaths | |
$packages = Get-Package | |
if (@($packages | Where-Object {$_.Name -eq 'PackageManagement'}).Count -eq 0) { | |
Write-Host -ForegroundColor cyan "PackageManager is installed but not being maintained via the PowerShell gallery (so it will never get updated). Forcing the install of this module through the gallery to rectify this now." | |
Install-Module PackageManagement -Force | |
Install-Module PowerShellGet -Force | |
Write-Host -ForegroundColor:Red "PowerShellGet and PackageManagement have been installed from the gallery. You need to close and rerun this script for them to work properly!" | |
Invoke-Reboot | |
} | |
else { | |
$InstalledModules = (Get-InstalledModule).name | |
$ModulesToBeInstalled = $ModulesToBeInstalled | Where-Object {$InstalledModules -notcontains $_} | |
if ($ModulesToBeInstalled.Count -gt 0) { | |
Write-Host -ForegroundColor:cyan "Installing modules that are not already installed via powershellget. Modules to be installed = $($ModulesToBeInstalled.Count)" | |
Install-Module -Name $ModulesToBeInstalled -AllowClobber -AcceptLicense -ErrorAction:SilentlyContinue | |
} | |
else { | |
Write-Output "No modules were found that needed to be installed." | |
} | |
} | |
<# | |
Install any chocolatey packages we want setup now | |
#> | |
Write-Output "Installing software via chocolatey" | |
# Don't try to download and install a package if it shows already installed | |
$InstalledChocoPackages = (Get-ChocoPackages).Name | |
$ChocoInstalls = $ChocoInstalls | Where { $InstalledChocoPackages -notcontains $_ } | |
if ($ChocoInstalls.Count -gt 0) { | |
# Install a ton of other crap I use or like, update $ChocoInsalls to suit your needs of course | |
$ChocoInstalls | Foreach-Object { | |
try { | |
choco upgrade -y $_ --cacheLocation "$($env:userprofile)\AppData\Local\Temp\chocolatey" | |
} | |
catch { | |
Write-Warning "Unable to install software package with Chocolatey: $($_)" | |
} | |
} | |
} | |
else { | |
Write-Output 'There were no packages to install!' | |
} | |
<# | |
Manually installed packages (not in chocolatey or packagemanager) | |
#> | |
If (-not (Test-Path $UtilDownloadPath)) { | |
mkdir $UtilDownloadPath -Force | |
} | |
If (-not (Test-Path $UtilBinPath)) { | |
mkdir $UtilBinPath -Force | |
} | |
Push-Location $UtilDownloadPath | |
# Store all the file we download for later processing | |
$FilesDownloaded = @() | |
<# | |
Hashicorp recent app downloads | |
- Find and download the most recent versions of Hashicorp applications as defined in | |
$HashicorpPackages. Ignores all plugins and providers. | |
#> | |
$HashicorpReleaseManifestURL = 'https://releases.hashicorp.com/index.json' | |
$HashiCorpJSONreq = (Invoke-WebRequest -Uri $HashicorpReleaseManifestURL -UseBasicParsing).Content | ConvertFrom-JSON | |
$HashiCorpJSONreq | Get-Member -MemberType 'NoteProperty' | Where-Object { $_.Name -notmatch "provider|plugin" } | ForEach-Object { | |
$software = $_.Name | |
$recentversion = Get-HashiCorpLatestVersion $HashiCorpJSONreq $software | |
if ($HashicorpPackages -contains $software) { | |
Write-Output "Found $software - $recentversion" | |
$HashiCorpJSONreq.$software.Versions.$recentversion.builds | Where {($_.os -eq $HashicorpOS) -and ($_.arch -match $HashicorpArch)} | Foreach { | |
if ( -not (Test-Path $_.filename)) { | |
try { | |
Invoke-WebRequest -Uri $_.url -OutFile $_.filename | |
$FilesDownloaded += $_.filename | |
} | |
catch {} | |
} | |
else { | |
Write-Warning "Hashicorp file is already downloaded, skipping: $($_.filename)" | |
} | |
} | |
} | |
} | |
# Github releases based software. | |
Foreach ($software in $GithubReleasesPackages.keys) { | |
$releases = "https://api.github.com/repos/$software/releases" | |
Write-Output "Determining latest release for repo $Software" | |
$tag = (Invoke-WebRequest $releases -UseBasicParsing | ConvertFrom-Json)[0] | |
$tag.assets | foreach { | |
if ($_.name -like $GithubReleasesPackages[$software]) { | |
if ( -not (Test-Path $_.name)) { | |
try { | |
Write-Output "Downloading $($_.name)..." | |
Invoke-WebRequest $_.'browser_download_url' -OutFile $_.Name | |
$FilesDownloaded += $_.Name | |
} | |
catch {} | |
} | |
else { | |
Write-Warning "File is already downloaded, skipping: $($_.Name)" | |
} | |
} | |
} | |
} | |
# Manually downloaded software | |
Foreach ($software in $ManualDownloadInstall.keys) { | |
Write-Output "Downloading $software" | |
if ( -not (Test-Path $software) ) { | |
try { | |
Invoke-WebRequest $ManualDownloadInstall[$software] -OutFile $software -UseBasicParsing | |
$FilesDownloaded += $software | |
} | |
catch {} | |
} | |
else { | |
Write-Warning "File is already downloaded, skipping: $software" | |
} | |
} | |
# Extracting self-contained binaries (zip files) to our bin folder | |
Write-Output 'Extracting self-contained binaries (zip files) to our bin folder' | |
Get-ChildItem -Path $UtilDownloadPath -File -Filter '*.zip' | Where {$FilesDownloaded -contains $_.Name} | Foreach { | |
Expand-Archive -Path $_.FullName -DestinationPath $UtilBinPath -Force | |
} | |
Add-EnvPath -Location 'User' -NewPath $UtilBinPath | |
Update-SessionEnvironment | |
# Kick off exe installs | |
Get-ChildItem -Path $UtilDownloadPath -File -Filter '*.exe' | Where {$FilesDownloaded -contains $_.Name} | Foreach { | |
Start-Proc -Exe $_.FullName -waitforexit | |
} | |
# Kick off msi installs | |
Get-ChildItem -Path $UtilDownloadPath -File -Filter '*.msi' | Where {$FilesDownloaded -contains $_.Name} | Foreach { | |
Start-Proc -Exe $_.FullName -waitforexit | |
} | |
<# | |
Configuration | |
#> | |
# keyprinha ini setup. If you don't use this launchy alternative then don't run this. | |
$keypirinhaconfigdata = @' | |
[app] | |
launch_at_startup = yes | |
hotkey_run = Alt+Space | |
escape_always_closes = yes | |
'@ | |
if ($null -ne (Get-Command 'keypirinha.exe' -ErrorAction:SilentlyContinue)) { | |
Write-Output 'Found keypirinha, attempting to configure...' | |
if ($null -eq (Get-Process -Name 'keypirinha-x64' -ErrorAction:SilentlyContinue)) { | |
Write-Output ' need to start KeyPirinha at least once to get the app directories created' | |
Start-Process -Name 'keypirinha.exe' | |
} | |
$keypirinhaconfig = join-path $SpecialPaths['ApplicationData'] 'Keypirinha\User\Keypirinha.ini' | |
if (-not (Test-Path $keypirinhaconfig)) { | |
Write-Output ' No custom user keypirinha config found, creating one that binds Alt+Space to launch the app..' | |
$keypirinhaconfigdata | Out-File -FilePath $keypirinhaconfig -Encoding:utf8 -Force | |
Stop-Process -Name 'keypirinha-x64' -ErrorAction:SilentlyContinue | |
Start-Process -Name 'keypirinha.exe' | |
} | |
else { | |
Write-Warning "KeyPirinha user config file already found and NOT overwritten: $keypirinhaconfig" | |
} | |
} | |
# Visual Studio Code extension setup | |
if ($null -ne (get-command 'code-insiders' -ErrorAction:SilentlyContinue)) { | |
Write-Host "Installing $($VSCodeExtensions.count) extensions to VS Code Insiders" | |
$VSCodeExtensions | ForEach-Object { | |
code-insiders --install-extension $_ | |
} | |
} | |
# Visual Studio Code extension setup | |
if ($null -ne (get-command 'code' -ErrorAction:SilentlyContinue)) { | |
Write-Host "Installing $($VSCodeExtensions.count) extensions to VS Code" | |
$VSCodeExtensions | ForEach-Object { | |
code --install-extension $_ | |
} | |
} | |
# Setup Defender bypass directory | |
$ByPassDefenderPaths | Add-DefenderBypassPath | |
Pop-Location | |
if ($ClearDesktopShortcuts) { | |
$Desktop = $SpecialPaths['DesktopDirectory'] | |
$DesktopShortcuts = Join-Path $Desktop 'Shortcuts' | |
if (-not (Test-Path $DesktopShortcuts)) { | |
Write-Host -ForegroundColor:Cyan "Creating a new shortcuts folder on your desktop and moving all .lnk files to it: $DesktopShortcuts" | |
$null = mkdir $DesktopShortcuts | |
} | |
Write-Output "Moving .lnk files from $($SpecialPaths['CommonDesktopDirectory']) to the Shortcuts folder" | |
Get-ChildItem -Path $SpecialPaths['CommonDesktopDirectory'] -Filter '*.lnk' | Foreach { | |
Move-Item -Path $_.FullName -Destination $DesktopShortcuts -ErrorAction:SilentlyContinue | |
} | |
Write-Output "Moving .lnk files from $Desktop to the Shortcuts folder" | |
Get-ChildItem -Path $Desktop -Filter '*.lnk' | Foreach { | |
Move-Item -Path $_.FullName -Destination $DesktopShortcuts -ErrorAction:SilentlyContinue | |
} | |
} | |
if ($CreatePowershellProfile -and (-not (Test-Path $PROFILE))) { | |
Write-Output 'Creating user powershell profile...' | |
$MyPowerShellProfile | Out-File -FilePath $PROFILE -Encoding:utf8 -Force | |
} | |
Install-WindowsUpdate -AcceptEula -GetUpdatesFromMS | |
Enable-UAC | |
if (Test-PendingReboot) { | |
Invoke-Reboot | |
} | |
Write-Host -ForegroundColor:Green "Install and configuration complete!" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment