├── .gitattributes ├── 1.SetupPC.bat ├── AppAssociations.xml ├── LICENSE ├── LayoutModification.xml ├── PCSetup.ps1 ├── README.md ├── RunMe.bat └── download.ps1 /.gitattributes: -------------------------------------------------------------------------------- 1 | # Auto detect text files and perform LF normalization 2 | * text=auto 3 | -------------------------------------------------------------------------------- /1.SetupPC.bat: -------------------------------------------------------------------------------- 1 | REM This file is only used if triggered manually. It can be ignored or deleted. RunMe.bat does not use this file in any way. 2 | mkdir c:\temp 3 | copy *.xml c:\temp\ 4 | Powershell.exe -Command "& {Start-Process Powershell.exe -ArgumentList 'set-executionpolicy remotesigned' -Verb RunAs}" 5 | powershell.exe -ExecutionPolicy Bypass -noprofile -command "&{start-process powershell -ArgumentList '-noprofile -file \"%~dp0PCSetup.ps1\"' -verb RunAs}" -------------------------------------------------------------------------------- /AppAssociations.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | This is free and unencumbered software released into the public domain. 2 | 3 | Anyone is free to copy, modify, publish, use, compile, sell, or 4 | distribute this software, either in source code form or as a compiled 5 | binary, for any purpose, commercial or non-commercial, and by any 6 | means. 7 | 8 | In jurisdictions that recognize copyright laws, the author or authors 9 | of this software dedicate any and all copyright interest in the 10 | software to the public domain. We make this dedication for the benefit 11 | of the public at large and to the detriment of our heirs and 12 | successors. We intend this dedication to be an overt act of 13 | relinquishment in perpetuity of all present and future rights to this 14 | software under copyright law. 15 | 16 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 17 | EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 18 | MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. 19 | IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR 20 | OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, 21 | ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR 22 | OTHER DEALINGS IN THE SOFTWARE. 23 | 24 | For more information, please refer to 25 | -------------------------------------------------------------------------------- /LayoutModification.xml: -------------------------------------------------------------------------------- 1 | 2 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | -------------------------------------------------------------------------------- /PCSetup.ps1: -------------------------------------------------------------------------------- 1 | Set-ExecutionPolicy remotesigned 2 | # Begin by creating the various functions which will be called at the end of the script. You can create additional functions if needed. 3 | function SetPCName { 4 | # In our MSP we designate all systems in the format devicetype-companyname-assetid for example DT-MSP-000001 keep in mind that this is the maximum length Windows allows for system names 5 | # This function creates VisualBasic pop-up prompts which ask for this information to be input. You can hange these as needed to suite your MSP 6 | Add-Type -AssemblyName Microsoft.VisualBasic 7 | $DeviceType = [Microsoft.VisualBasic.Interaction]::InputBox('Enter Device Type (LT or DT)', 'Device Type') 8 | $CompanyName = [Microsoft.VisualBasic.Interaction]::InputBox('Enter Company Initials (Max 4 letters)', 'Company Initials') 9 | $AssetID = [Microsoft.VisualBasic.Interaction]::InputBox('Enter a Asset ID', 'Asset ID') 10 | Write-Output "The asset ID is $AssetID" 11 | Write-Output "$DeviceType-$CompanyName-$AssetID" 12 | Rename-Computer -NewName "$DeviceType-$CompanyName-$AssetID" 13 | } 14 | 15 | function InstallChoco { 16 | # Ask for elevated permissions if required 17 | If (!([Security.Principal.WindowsPrincipal][Security.Principal.WindowsIdentity]::GetCurrent()).IsInRole([Security.Principal.WindowsBuiltInRole]"Administrator")) { 18 | Start-Process powershell.exe "-NoProfile -ExecutionPolicy Bypass -File `"$PSCommandPath`"" -Verb RunAs 19 | Exit 20 | } 21 | # Install Chocolatey to allow automated installation of packages 22 | Set-ExecutionPolicy Bypass -Scope Process -Force; iex ((New-Object System.Net.WebClient).DownloadString('https://chocolatey.org/install.ps1')) 23 | } 24 | 25 | function InstallApps { 26 | # Install the first set of applications. these are quick so ive added them separately 27 | choco install adobereader 7zip microsoft-edge -y 28 | # Install Office365 applications. This takes a while so is done separately. You can change the options here by following the instructions here: https://chocolatey.org/packages/microsoft-office-deployment 29 | choco install microsoft-office-deployment --params="'/Channel:Monthly /Language:en-us /64bit /Product:O365BusinessRetail /Exclude:Lync,Groove'" -y 30 | #choco install microsoft-office-deployment --params="'/Channel:Monthly /Language:en-us /Product:O365BusinessRetail /Exclude:Lync,Groove'" -y 31 | } 32 | 33 | function ReclaimWindows10 { 34 | # Ask for elevated permissions if required 35 | If (!([Security.Principal.WindowsPrincipal][Security.Principal.WindowsIdentity]::GetCurrent()).IsInRole([Security.Principal.WindowsBuiltInRole]"Administrator")) { 36 | Start-Process powershell.exe "-NoProfile -ExecutionPolicy Bypass -File `"$PSCommandPath`"" -Verb RunAs 37 | Exit 38 | } 39 | 40 | 41 | # Massive deployment section. There are stacks of customization options here. Un-hash the ones your want to apply. 42 | ########## 43 | # Privacy Settings 44 | ########## 45 | 46 | # Disable Telemetry 47 | Write-Host "Disabling Telemetry..." 48 | Set-ItemProperty -Path "HKLM:\Software\Policies\Microsoft\Windows\DataCollection" -Name "AllowTelemetry" -Type DWord -Value 0 49 | 50 | # Enable Telemetry 51 | # Remove-ItemProperty -Path "HKLM:\Software\Policies\Microsoft\Windows\DataCollection" -Name "AllowTelemetry" 52 | 53 | # Disable Wi-Fi Sense 54 | Write-Host "Disabling Wi-Fi Sense..." 55 | If (!(Test-Path "HKLM:\Software\Microsoft\PolicyManager\default\WiFi\AllowWiFiHotSpotReporting")) { 56 | New-Item -Path "HKLM:\Software\Microsoft\PolicyManager\default\WiFi\AllowWiFiHotSpotReporting" -Force | Out-Null 57 | } 58 | Set-ItemProperty -Path "HKLM:\Software\Microsoft\PolicyManager\default\WiFi\AllowWiFiHotSpotReporting" -Name "Value" -Type DWord -Value 0 59 | Set-ItemProperty -Path "HKLM:\Software\Microsoft\PolicyManager\default\WiFi\AllowAutoConnectToWiFiSenseHotspots" -Name "Value" -Type DWord -Value 0 60 | 61 | # Enable Wi-Fi Sense 62 | # Set-ItemProperty -Path "HKLM:\Software\Microsoft\PolicyManager\default\WiFi\AllowWiFiHotSpotReporting" -Name "Value" -Type DWord -Value 1 63 | # Set-ItemProperty -Path "HKLM:\Software\Microsoft\PolicyManager\default\WiFi\AllowAutoConnectToWiFiSenseHotspots" -Name "Value" -Type DWord -Value 1 64 | 65 | # Disable SmartScreen Filter 66 | # Write-Host "Disabling SmartScreen Filter..." 67 | # Set-ItemProperty -Path "HKLM:\Software\Microsoft\Windows\CurrentVersion\Explorer" -Name "SmartScreenEnabled" -Type String -Value "Off" 68 | # Set-ItemProperty -Path "HKCU:\Software\Microsoft\Windows\CurrentVersion\AppHost" -Name "EnableWebContentEvaluation" -Type DWord -Value 0 69 | 70 | # Enable SmartScreen Filter 71 | # Set-ItemProperty -Path "HKLM:\Software\Microsoft\Windows\CurrentVersion\Explorer" -Name "SmartScreenEnabled" -Type String -Value "RequireAdmin" 72 | # Remove-ItemProperty -Path "HKCU:\Software\Microsoft\Windows\CurrentVersion\AppHost" -Name "EnableWebContentEvaluation" 73 | 74 | # Disable Bing Search in Start Menu 75 | Write-Host "Disabling Bing Search in Start Menu..." 76 | Set-ItemProperty -Path "HKCU:\Software\Microsoft\Windows\CurrentVersion\Search" -Name "BingSearchEnabled" -Type DWord -Value 0 77 | 78 | # Enable Bing Search in Start Menu 79 | # Remove-ItemProperty -Path "HKCU:\Software\Microsoft\Windows\CurrentVersion\Search" -Name "BingSearchEnabled" 80 | 81 | # Disable Location Tracking 82 | Write-Host "Disabling Location Tracking..." 83 | Set-ItemProperty -Path "HKLM:\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Sensor\Overrides\{BFA794E4-F964-4FDB-90F6-51056BFE4B44}" -Name "SensorPermissionState" -Type DWord -Value 0 84 | Set-ItemProperty -Path "HKLM:\System\CurrentControlSet\Services\lfsvc\Service\Configuration" -Name "Status" -Type DWord -Value 0 85 | 86 | # Enable Location Tracking 87 | # Set-ItemProperty -Path "HKLM:\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Sensor\Overrides\{BFA794E4-F964-4FDB-90F6-51056BFE4B44}" -Name "SensorPermissionState" -Type DWord -Value 1 88 | # Set-ItemProperty -Path "HKLM:\System\CurrentControlSet\Services\lfsvc\Service\Configuration" -Name "Status" -Type DWord -Value 1 89 | 90 | # Disable Feedback 91 | Write-Host "Disabling Feedback..." 92 | If (!(Test-Path "HKCU:\Software\Microsoft\Siuf\Rules")) { 93 | New-Item -Path "HKCU:\Software\Microsoft\Siuf\Rules" -Force | Out-Null 94 | } 95 | Set-ItemProperty -Path "HKCU:\Software\Microsoft\Siuf\Rules" -Name "NumberOfSIUFInPeriod" -Type DWord -Value 0 96 | 97 | # Enable Feedback 98 | # Remove-ItemProperty -Path "HKCU:\Software\Microsoft\Siuf\Rules" -Name "NumberOfSIUFInPeriod" 99 | 100 | # Disable Advertising ID 101 | Write-Host "Disabling Advertising ID..." 102 | If (!(Test-Path "HKCU:\Software\Microsoft\Windows\CurrentVersion\AdvertisingInfo")) { 103 | New-Item -Path "HKCU:\Software\Microsoft\Windows\CurrentVersion\AdvertisingInfo" | Out-Null 104 | } 105 | Set-ItemProperty -Path "HKCU:\Software\Microsoft\Windows\CurrentVersion\AdvertisingInfo" -Name "Enabled" -Type DWord -Value 0 106 | 107 | # Enable Advertising ID 108 | # Remove-ItemProperty -Path "HKCU:\Software\Microsoft\Windows\CurrentVersion\AdvertisingInfo" -Name "Enabled" 109 | 110 | # Disable Cortana 111 | Write-Host "Disabling Cortana..." 112 | If (!(Test-Path "HKCU:\Software\Microsoft\Personalization\Settings")) { 113 | New-Item -Path "HKCU:\Software\Microsoft\Personalization\Settings" -Force | Out-Null 114 | } 115 | Set-ItemProperty -Path "HKCU:\Software\Microsoft\Personalization\Settings" -Name "AcceptedPrivacyPolicy" -Type DWord -Value 0 116 | If (!(Test-Path "HKCU:\Software\Microsoft\InputPersonalization")) { 117 | New-Item -Path "HKCU:\Software\Microsoft\InputPersonalization" -Force | Out-Null 118 | } 119 | Set-ItemProperty -Path "HKCU:\Software\Microsoft\InputPersonalization" -Name "RestrictImplicitTextCollection" -Type DWord -Value 1 120 | Set-ItemProperty -Path "HKCU:\Software\Microsoft\InputPersonalization" -Name "RestrictImplicitInkCollection" -Type DWord -Value 1 121 | If (!(Test-Path "HKCU:\Software\Microsoft\InputPersonalization\TrainedDataStore")) { 122 | New-Item -Path "HKCU:\Software\Microsoft\InputPersonalization\TrainedDataStore" -Force | Out-Null 123 | } 124 | Set-ItemProperty -Path "HKCU:\Software\Microsoft\InputPersonalization\TrainedDataStore" -Name "HarvestContacts" -Type DWord -Value 0 125 | 126 | # Enable Cortana 127 | # Remove-ItemProperty -Path "HKCU:\Software\Microsoft\Personalization\Settings" -Name "AcceptedPrivacyPolicy" 128 | # Set-ItemProperty -Path "HKCU:\Software\Microsoft\InputPersonalization" -Name "RestrictImplicitTextCollection" -Type DWord -Value 0 129 | # Set-ItemProperty -Path "HKCU:\Software\Microsoft\InputPersonalization" -Name "RestrictImplicitInkCollection" -Type DWord -Value 0 130 | # Remove-ItemProperty -Path "HKCU:\Software\Microsoft\InputPersonalization\TrainedDataStore" -Name "HarvestContacts" 131 | 132 | # Restrict Windows Update P2P only to local network 133 | Write-Host "Restricting Windows Update P2P only to local network..." 134 | Set-ItemProperty -Path "HKLM:\Software\Microsoft\Windows\CurrentVersion\DeliveryOptimization\Config" -Name "DODownloadMode" -Type DWord -Value 1 135 | If (!(Test-Path "HKCU:\Software\Microsoft\Windows\CurrentVersion\DeliveryOptimization")) { 136 | New-Item -Path "HKCU:\Software\Microsoft\Windows\CurrentVersion\DeliveryOptimization" | Out-Null 137 | } 138 | Set-ItemProperty -Path "HKCU:\Software\Microsoft\Windows\CurrentVersion\DeliveryOptimization" -Name "SystemSettingsDownloadMode" -Type DWord -Value 3 139 | 140 | # Unrestrict Windows Update P2P 141 | # Remove-ItemProperty -Path "HKLM:\Software\Microsoft\Windows\CurrentVersion\DeliveryOptimization\Config" -Name "DODownloadMode" 142 | # Remove-ItemProperty -Path "HKCU:\Software\Microsoft\Windows\CurrentVersion\DeliveryOptimization" -Name "SystemSettingsDownloadMode" 143 | 144 | # Remove AutoLogger file and restrict directory 145 | Write-Host "Removing AutoLogger file and restricting directory..." 146 | $autoLoggerDir = "$env:PROGRAMDATA\Microsoft\Diagnosis\ETLLogs\AutoLogger" 147 | If (Test-Path "$autoLoggerDir\AutoLogger-Diagtrack-Listener.etl") { 148 | Remove-Item "$autoLoggerDir\AutoLogger-Diagtrack-Listener.etl" 149 | } 150 | icacls $autoLoggerDir /deny SYSTEM:`(OI`)`(CI`)F | Out-Null 151 | 152 | # Unrestrict AutoLogger directory 153 | # $autoLoggerDir = "$env:PROGRAMDATA\Microsoft\Diagnosis\ETLLogs\AutoLogger" 154 | # icacls $autoLoggerDir /grant:r SYSTEM:`(OI`)`(CI`)F | Out-Null 155 | 156 | # Stop and disable Diagnostics Tracking Service 157 | Write-Host "Stopping and disabling Diagnostics Tracking Service..." 158 | Stop-Service "DiagTrack" 159 | Set-Service "DiagTrack" -StartupType Disabled 160 | 161 | # Enable and start Diagnostics Tracking Service 162 | # Set-Service "DiagTrack" -StartupType Automatic 163 | # Start-Service "DiagTrack" 164 | 165 | # Stop and disable WAP Push Service 166 | Write-Host "Stopping and disabling WAP Push Service..." 167 | Stop-Service "dmwappushservice" 168 | Set-Service "dmwappushservice" -StartupType Disabled 169 | 170 | # Enable and start WAP Push Service 171 | # Set-Service "dmwappushservice" -StartupType Automatic 172 | # Start-Service "dmwappushservice" 173 | # Set-ItemProperty -Path "HKLM:\SYSTEM\CurrentControlSet\Services\dmwappushservice" -Name "DelayedAutoStart" -Type DWord -Value 1 174 | 175 | 176 | 177 | ########## 178 | # Service Tweaks 179 | ########## 180 | 181 | # Lower UAC level 182 | # Write-Host "Lowering UAC level..." 183 | # Set-ItemProperty -Path "HKLM:\Software\Microsoft\Windows\CurrentVersion\Policies\System" -Name "ConsentPromptBehaviorAdmin" -Type DWord -Value 0 184 | # Set-ItemProperty -Path "HKLM:\Software\Microsoft\Windows\CurrentVersion\Policies\System" -Name "PromptOnSecureDesktop" -Type DWord -Value 0 185 | 186 | # Raise UAC level 187 | # Set-ItemProperty -Path "HKLM:\Software\Microsoft\Windows\CurrentVersion\Policies\System" -Name "ConsentPromptBehaviorAdmin" -Type DWord -Value 5 188 | # Set-ItemProperty -Path "HKLM:\Software\Microsoft\Windows\CurrentVersion\Policies\System" -Name "PromptOnSecureDesktop" -Type DWord -Value 1 189 | 190 | # Enable sharing mapped drives between users 191 | # Write-Host "Enabling sharing mapped drives between users..." 192 | # Set-ItemProperty -Path "HKLM:\Software\Microsoft\Windows\CurrentVersion\Policies\System" -Name "EnableLinkedConnections" -Type DWord -Value 1 193 | 194 | # Disable sharing mapped drives between users 195 | # Remove-ItemProperty -Path "HKLM:\Software\Microsoft\Windows\CurrentVersion\Policies\System" -Name "EnableLinkedConnections" 196 | 197 | # Disable Firewall 198 | # Write-Host "Disabling Firewall..." 199 | # Set-NetFirewallProfile -Profile * -Enabled False 200 | 201 | # Enable Firewall 202 | # Set-NetFirewallProfile -Profile * -Enabled True 203 | 204 | # Disable Windows Defender 205 | # Write-Host "Disabling Windows Defender..." 206 | # Set-ItemProperty -Path "HKLM:\Software\Policies\Microsoft\Windows Defender" -Name "DisableAntiSpyware" -Type DWord -Value 1 207 | 208 | # Enable Windows Defender 209 | # Remove-ItemProperty -Path "HKLM:\Software\Policies\Microsoft\Windows Defender" -Name "DisableAntiSpyware" 210 | 211 | # Disable Windows Update automatic restart 212 | Write-Host "Disabling Windows Update automatic restart..." 213 | Set-ItemProperty -Path "HKLM:\Software\Microsoft\WindowsUpdate\UX\Settings" -Name "UxOption" -Type DWord -Value 1 214 | 215 | # Enable Windows Update automatic restart 216 | # Set-ItemProperty -Path "HKLM:\Software\Microsoft\WindowsUpdate\UX\Settings" -Name "UxOption" -Type DWord -Value 0 217 | 218 | # Stop and disable Home Groups services 219 | # Write-Host "Stopping and disabling Home Groups services..." 220 | # Stop-Service "HomeGroupListener" 221 | # Set-Service "HomeGroupListener" -StartupType Disabled 222 | # Stop-Service "HomeGroupProvider" 223 | # Set-Service "HomeGroupProvider" -StartupType Disabled 224 | 225 | # Enable and start Home Groups services 226 | # Set-Service "HomeGroupListener" -StartupType Manual 227 | # Set-Service "HomeGroupProvider" -StartupType Manual 228 | # Start-Service "HomeGroupProvider" 229 | 230 | # Disable Remote Assistance 231 | # Write-Host "Disabling Remote Assistance..." 232 | # Set-ItemProperty -Path "HKLM:\System\CurrentControlSet\Control\Remote Assistance" -Name "fAllowToGetHelp" -Type DWord -Value 0 233 | 234 | # Enable Remote Assistance 235 | # Set-ItemProperty -Path "HKLM:\System\CurrentControlSet\Control\Remote Assistance" -Name "fAllowToGetHelp" -Type DWord -Value 1 236 | 237 | # Enable Remote Desktop w/o Network Level Authentication 238 | # Write-Host "Enabling Remote Desktop w/o Network Level Authentication..." 239 | # Set-ItemProperty -Path "HKLM:\System\CurrentControlSet\Control\Terminal Server" -Name "fDenyTSConnections" -Type DWord -Value 0 240 | # Set-ItemProperty -Path "HKLM:\System\CurrentControlSet\Control\Terminal Server\WinStations\RDP-Tcp" -Name "UserAuthentication" -Type DWord -Value 0 241 | 242 | # Disable Remote Desktop 243 | # Set-ItemProperty -Path "HKLM:\System\CurrentControlSet\Control\Terminal Server" -Name "fDenyTSConnections" -Type DWord -Value 1 244 | # Set-ItemProperty -Path "HKLM:\System\CurrentControlSet\Control\Terminal Server\WinStations\RDP-Tcp" -Name "UserAuthentication" -Type DWord -Value 1 245 | 246 | 247 | 248 | ########## 249 | # UI Tweaks 250 | ########## 251 | 252 | # Disable Action Center 253 | Write-Host "Disabling Action Center..." 254 | If (!(Test-Path "HKCU:\Software\Policies\Microsoft\Windows\Explorer")) { 255 | New-Item -Path "HKCU:\Software\Policies\Microsoft\Windows\Explorer" | Out-Null 256 | } 257 | Set-ItemProperty -Path "HKCU:\Software\Policies\Microsoft\Windows\Explorer" -Name "DisableNotificationCenter" -Type DWord -Value 1 258 | Set-ItemProperty -Path "HKCU:\Software\Microsoft\Windows\CurrentVersion\PushNotifications" -Name "ToastEnabled" -Type DWord -Value 0 259 | 260 | # Enable Action Center 261 | # Remove-ItemProperty -Path "HKCU:\Software\Policies\Microsoft\Windows\Explorer" -Name "DisableNotificationCenter" 262 | # Remove-ItemProperty -Path "HKCU:\Software\Microsoft\Windows\CurrentVersion\PushNotifications" -Name "ToastEnabled" 263 | 264 | # Disable Lock screen 265 | #Write-Host "Disabling Lock screen..." 266 | #If (!(Test-Path "HKLM:\Software\Policies\Microsoft\Windows\Personalization")) { 267 | # New-Item -Path "HKLM:\Software\Policies\Microsoft\Windows\Personalization" | Out-Null 268 | #} 269 | #Set-ItemProperty -Path "HKLM:\Software\Policies\Microsoft\Windows\Personalization" -Name "NoLockScreen" -Type DWord -Value 1 270 | 271 | # Enable Lock screen 272 | # Remove-ItemProperty -Path "HKLM:\Software\Policies\Microsoft\Windows\Personalization" -Name "NoLockScreen" 273 | 274 | # Disable Autoplay 275 | Write-Host "Disabling Autoplay..." 276 | Set-ItemProperty -Path "HKCU:\Software\Microsoft\Windows\CurrentVersion\Explorer\AutoplayHandlers" -Name "DisableAutoplay" -Type DWord -Value 1 277 | 278 | # Enable Autoplay 279 | # Set-ItemProperty -Path "HKCU:\Software\Microsoft\Windows\CurrentVersion\Explorer\AutoplayHandlers" -Name "DisableAutoplay" -Type DWord -Value 0 280 | 281 | # Disable Autorun for all drives 282 | Write-Host "Disabling Autorun for all drives..." 283 | If (!(Test-Path "HKCU:\Software\Microsoft\Windows\CurrentVersion\Policies\Explorer")) { 284 | New-Item -Path "HKCU:\Software\Microsoft\Windows\CurrentVersion\Policies\Explorer" | Out-Null 285 | } 286 | Set-ItemProperty -Path "HKCU:\Software\Microsoft\Windows\CurrentVersion\Policies\Explorer" -Name "NoDriveTypeAutoRun" -Type DWord -Value 255 287 | 288 | # Enable Autorun 289 | # Remove-ItemProperty -Path "HKCU:\Software\Microsoft\Windows\CurrentVersion\Policies\Explorer" -Name "NoDriveTypeAutoRun" 290 | 291 | #Disable Sticky keys prompt 292 | Write-Host "Disabling Sticky keys prompt..." 293 | Set-ItemProperty -Path "HKCU:\Control Panel\Accessibility\StickyKeys" -Name "Flags" -Type String -Value "506" 294 | 295 | # Enable Sticky keys prompt 296 | # Set-ItemProperty -Path "HKCU:\Control Panel\Accessibility\StickyKeys" -Name "Flags" -Type String -Value "510" 297 | 298 | # Hide Search button / box 299 | Write-Host "Hiding Search Box / Button..." 300 | Set-ItemProperty -Path "HKCU:\Software\Microsoft\Windows\CurrentVersion\Search" -Name "SearchboxTaskbarMode" -Type DWord -Value 0 301 | 302 | # Show Search button / box 303 | # Remove-ItemProperty -Path "HKCU:\Software\Microsoft\Windows\CurrentVersion\Search" -Name "SearchboxTaskbarMode" 304 | 305 | # Hide Task View button 306 | Write-Host "Hiding Task View button..." 307 | Set-ItemProperty -Path "HKCU:\Software\Microsoft\Windows\CurrentVersion\Explorer\Advanced" -Name "ShowTaskViewButton" -Type DWord -Value 0 308 | 309 | # Show Task View button 310 | # Remove-ItemProperty -Path "HKCU:\Software\Microsoft\Windows\CurrentVersion\Explorer\Advanced" -Name "ShowTaskViewButton" 311 | 312 | # Show small icons in taskbar 313 | # Write-Host "Showing small icons in taskbar..." 314 | # Set-ItemProperty -Path "HKCU:\Software\Microsoft\Windows\CurrentVersion\Explorer\Advanced" -Name "TaskbarSmallIcons" -Type DWord -Value 1 315 | 316 | # Show large icons in taskbar 317 | # Remove-ItemProperty -Path "HKCU:\Software\Microsoft\Windows\CurrentVersion\Explorer\Advanced" -Name "TaskbarSmallIcons" 318 | 319 | # Show titles in taskbar 320 | # Write-Host "Showing titles in taskbar..." 321 | # Set-ItemProperty -Path "HKCU:\Software\Microsoft\Windows\CurrentVersion\Explorer\Advanced" -Name "TaskbarGlomLevel" -Type DWord -Value 1 322 | 323 | # Hide titles in taskbar 324 | # Remove-ItemProperty -Path "HKCU:\Software\Microsoft\Windows\CurrentVersion\Explorer\Advanced" -Name "TaskbarGlomLevel" 325 | 326 | # Show all tray icons 327 | # Write-Host "Showing all tray icons..." 328 | # Set-ItemProperty -Path "HKCU:\Software\Microsoft\Windows\CurrentVersion\Explorer" -Name "EnableAutoTray" -Type DWord -Value 0 329 | 330 | # Hide tray icons as needed 331 | # Remove-ItemProperty -Path "HKCU:\Software\Microsoft\Windows\CurrentVersion\Explorer" -Name "EnableAutoTray" 332 | 333 | # Show known file extensions 334 | Write-Host "Showing known file extensions..." 335 | Set-ItemProperty -Path "HKCU:\Software\Microsoft\Windows\CurrentVersion\Explorer\Advanced" -Name "HideFileExt" -Type DWord -Value 0 336 | 337 | # Hide known file extensions 338 | # Set-ItemProperty -Path "HKCU:\Software\Microsoft\Windows\CurrentVersion\Explorer\Advanced" -Name "HideFileExt" -Type DWord -Value 1 339 | 340 | # Show hidden files 341 | #Write-Host "Showing hidden files..." 342 | #Set-ItemProperty -Path "HKCU:\Software\Microsoft\Windows\CurrentVersion\Explorer\Advanced" -Name "Hidden" -Type DWord -Value 1 343 | 344 | # Hide hidden files 345 | # Set-ItemProperty -Path "HKCU:\Software\Microsoft\Windows\CurrentVersion\Explorer\Advanced" -Name "Hidden" -Type DWord -Value 2 346 | 347 | # Change default Explorer view to "Computer" 348 | Write-Host "Changing default Explorer view to `"Computer`"..." 349 | Set-ItemProperty -Path "HKCU:\Software\Microsoft\Windows\CurrentVersion\Explorer\Advanced" -Name "LaunchTo" -Type DWord -Value 1 350 | 351 | # Change default Explorer view to "Quick Access" 352 | # Remove-ItemProperty -Path "HKCU:\Software\Microsoft\Windows\CurrentVersion\Explorer\Advanced" -Name "LaunchTo" 353 | 354 | # Show Computer shortcut on desktop 355 | # Write-Host "Showing Computer shortcut on desktop..." 356 | # If (!(Test-Path "HKCU:\Software\Microsoft\Windows\CurrentVersion\Explorer\HideDesktopIcons\ClassicStartMenu")) { 357 | # New-Item -Path "HKCU:\Software\Microsoft\Windows\CurrentVersion\Explorer\HideDesktopIcons\ClassicStartMenu" | Out-Null 358 | # } 359 | # Set-ItemProperty -Path "HKCU:\Software\Microsoft\Windows\CurrentVersion\Explorer\HideDesktopIcons\ClassicStartMenu" -Name "{20D04FE0-3AEA-1069-A2D8-08002B30309D}" -Type DWord -Value 0 360 | # Set-ItemProperty -Path "HKCU:\Software\Microsoft\Windows\CurrentVersion\Explorer\HideDesktopIcons\NewStartPanel" -Name "{20D04FE0-3AEA-1069-A2D8-08002B30309D}" -Type DWord -Value 0 361 | 362 | # Hide Computer shortcut from desktop 363 | # Remove-ItemProperty -Path "HKCU:\Software\Microsoft\Windows\CurrentVersion\Explorer\HideDesktopIcons\ClassicStartMenu" -Name "{20D04FE0-3AEA-1069-A2D8-08002B30309D}" 364 | # Remove-ItemProperty -Path "HKCU:\Software\Microsoft\Windows\CurrentVersion\Explorer\HideDesktopIcons\NewStartPanel" -Name "{20D04FE0-3AEA-1069-A2D8-08002B30309D}" 365 | 366 | # Remove Desktop icon from computer namespace 367 | # Write-Host "Removing Desktop icon from computer namespace..." 368 | # Remove-Item -Path "HKLM:\Software\Microsoft\Windows\CurrentVersion\Explorer\MyComputer\NameSpace\{B4BFCC3A-DB2C-424C-B029-7FE99A87C641}" -Recurse -ErrorAction SilentlyContinue 369 | 370 | # Add Desktop icon to computer namespace 371 | # New-Item -Path "HKLM:\Software\Microsoft\Windows\CurrentVersion\Explorer\MyComputer\NameSpace\{B4BFCC3A-DB2C-424C-B029-7FE99A87C641}" 372 | 373 | # Remove Documents icon from computer namespace 374 | # Write-Host "Removing Documents icon from computer namespace..." 375 | # Remove-Item -Path "HKLM:\Software\Microsoft\Windows\CurrentVersion\Explorer\MyComputer\NameSpace\{d3162b92-9365-467a-956b-92703aca08af}" -Recurse -ErrorAction SilentlyContinue 376 | # Remove-Item -Path "HKLM:\Software\Microsoft\Windows\CurrentVersion\Explorer\MyComputer\NameSpace\{A8CDFF1C-4878-43be-B5FD-F8091C1C60D0}" -Recurse -ErrorAction SilentlyContinue 377 | 378 | # Add Documents icon to computer namespace 379 | # New-Item -Path "HKLM:\Software\Microsoft\Windows\CurrentVersion\Explorer\MyComputer\NameSpace\{d3162b92-9365-467a-956b-92703aca08af}" 380 | # New-Item -Path "HKLM:\Software\Microsoft\Windows\CurrentVersion\Explorer\MyComputer\NameSpace\{A8CDFF1C-4878-43be-B5FD-F8091C1C60D0}" 381 | 382 | # Remove Downloads icon from computer namespace 383 | # Write-Host "Removing Downloads icon from computer namespace..." 384 | # Remove-Item -Path "HKLM:\Software\Microsoft\Windows\CurrentVersion\Explorer\MyComputer\NameSpace\{088e3905-0323-4b02-9826-5d99428e115f}" -Recurse -ErrorAction SilentlyContinue 385 | # Remove-Item -Path "HKLM:\Software\Microsoft\Windows\CurrentVersion\Explorer\MyComputer\NameSpace\{374DE290-123F-4565-9164-39C4925E467B}" -Recurse -ErrorAction SilentlyContinue 386 | 387 | # Add Downloads icon to computer namespace 388 | # New-Item -Path "HKLM:\Software\Microsoft\Windows\CurrentVersion\Explorer\MyComputer\NameSpace\{088e3905-0323-4b02-9826-5d99428e115f}" 389 | # New-Item -Path "HKLM:\Software\Microsoft\Windows\CurrentVersion\Explorer\MyComputer\NameSpace\{374DE290-123F-4565-9164-39C4925E467B}" 390 | 391 | # Remove Music icon from computer namespace 392 | # Write-Host "Removing Music icon from computer namespace..." 393 | # Remove-Item -Path "HKLM:\Software\Microsoft\Windows\CurrentVersion\Explorer\MyComputer\NameSpace\{3dfdf296-dbec-4fb4-81d1-6a3438bcf4de}" -Recurse -ErrorAction SilentlyContinue 394 | # Remove-Item -Path "HKLM:\Software\Microsoft\Windows\CurrentVersion\Explorer\MyComputer\NameSpace\{1CF1260C-4DD0-4ebb-811F-33C572699FDE}" -Recurse -ErrorAction SilentlyContinue 395 | 396 | # Add Music icon to computer namespace 397 | # New-Item -Path "HKLM:\Software\Microsoft\Windows\CurrentVersion\Explorer\MyComputer\NameSpace\{3dfdf296-dbec-4fb4-81d1-6a3438bcf4de}" 398 | # New-Item -Path "HKLM:\Software\Microsoft\Windows\CurrentVersion\Explorer\MyComputer\NameSpace\{1CF1260C-4DD0-4ebb-811F-33C572699FDE}" 399 | 400 | # Remove Pictures icon from computer namespace 401 | #Write-Host "Removing Pictures icon from computer namespace..." 402 | #Remove-Item -Path "HKLM:\Software\Microsoft\Windows\CurrentVersion\Explorer\MyComputer\NameSpace\{24ad3ad4-a569-4530-98e1-ab02f9417aa8}" -Recurse -ErrorAction SilentlyContinue 403 | #Remove-Item -Path "HKLM:\Software\Microsoft\Windows\CurrentVersion\Explorer\MyComputer\NameSpace\{3ADD1653-EB32-4cb0-BBD7-DFA0ABB5ACCA}" -Recurse -ErrorAction SilentlyContinue 404 | 405 | # Add Pictures icon to computer namespace 406 | # New-Item -Path "HKLM:\Software\Microsoft\Windows\CurrentVersion\Explorer\MyComputer\NameSpace\{24ad3ad4-a569-4530-98e1-ab02f9417aa8}" 407 | # New-Item -Path "HKLM:\Software\Microsoft\Windows\CurrentVersion\Explorer\MyComputer\NameSpace\{3ADD1653-EB32-4cb0-BBD7-DFA0ABB5ACCA}" 408 | 409 | # Remove Videos icon from computer namespace 410 | #Write-Host "Removing Videos icon from computer namespace..." 411 | #Remove-Item -Path "HKLM:\Software\Microsoft\Windows\CurrentVersion\Explorer\MyComputer\NameSpace\{f86fa3ab-70d2-4fc7-9c99-fcbf05467f3a}" -Recurse -ErrorAction SilentlyContinue 412 | #Remove-Item -Path "HKLM:\Software\Microsoft\Windows\CurrentVersion\Explorer\MyComputer\NameSpace\{A0953C92-50DC-43bf-BE83-3742FED03C9C}" -Recurse -ErrorAction SilentlyContinue 413 | 414 | # Add Videos icon to computer namespace 415 | # New-Item -Path "HKLM:\Software\Microsoft\Windows\CurrentVersion\Explorer\MyComputer\NameSpace\{f86fa3ab-70d2-4fc7-9c99-fcbf05467f3a}" 416 | # New-Item -Path "HKLM:\Software\Microsoft\Windows\CurrentVersion\Explorer\MyComputer\NameSpace\{A0953C92-50DC-43bf-BE83-3742FED03C9C}" 417 | 418 | ## Add secondary en-US keyboard 419 | #Write-Host "Adding secondary en-US keyboard..." 420 | #$langs = Get-WinUserLanguageList 421 | #$langs.Add("en-US") 422 | #Set-WinUserLanguageList $langs -Force 423 | 424 | # Remove secondary en-US keyboard 425 | # $langs = Get-WinUserLanguageList 426 | # Set-WinUserLanguageList ($langs | ? {$_.LanguageTag -ne "en-US"}) -Force 427 | 428 | 429 | 430 | ########## 431 | # Remove unwanted applications 432 | ########## 433 | 434 | # Disable OneDrive 435 | # Write-Host "Disabling OneDrive..." 436 | # If (!(Test-Path "HKLM:\SOFTWARE\Policies\Microsoft\Windows\OneDrive")) { 437 | # New-Item -Path "HKLM:\SOFTWARE\Policies\Microsoft\Windows\OneDrive" | Out-Null 438 | # } 439 | # Set-ItemProperty -Path "HKLM:\SOFTWARE\Policies\Microsoft\Windows\OneDrive" -Name "DisableFileSyncNGSC" -Type DWord -Value 1 440 | 441 | # Enable OneDrive 442 | # Remove-ItemProperty -Path "HKLM:\SOFTWARE\Policies\Microsoft\Windows\OneDrive" -Name "DisableFileSyncNGSC" 443 | 444 | # Uninstall OneDrive 445 | # Write-Host "Uninstalling OneDrive..." 446 | # Stop-Process -Name OneDrive -ErrorAction SilentlyContinue 447 | # Start-Sleep -s 3 448 | # $onedrive = "$env:SYSTEMROOT\SysWOW64\OneDriveSetup.exe" 449 | # If (!(Test-Path $onedrive)) { 450 | # $onedrive = "$env:SYSTEMROOT\System32\OneDriveSetup.exe" 451 | # } 452 | # Start-Process $onedrive "/uninstall" -NoNewWindow -Wait 453 | # Start-Sleep -s 3 454 | # Stop-Process -Name explorer -ErrorAction SilentlyContinue 455 | # Start-Sleep -s 3 456 | # Remove-Item "$env:USERPROFILE\OneDrive" -Force -Recurse -ErrorAction SilentlyContinue 457 | # Remove-Item "$env:LOCALAPPDATA\Microsoft\OneDrive" -Force -Recurse -ErrorAction SilentlyContinue 458 | # Remove-Item "$env:PROGRAMDATA\Microsoft OneDrive" -Force -Recurse -ErrorAction SilentlyContinue 459 | # If (Test-Path "$env:SYSTEMDRIVE\OneDriveTemp") { 460 | # Remove-Item "$env:SYSTEMDRIVE\OneDriveTemp" -Force -Recurse -ErrorAction SilentlyContinue 461 | # } 462 | # If (!(Test-Path "HKCR:")) { 463 | # New-PSDrive -Name HKCR -PSProvider Registry -Root HKEY_CLASSES_ROOT | Out-Null 464 | # } 465 | # Remove-Item -Path "HKCR:\CLSID\{018D5C66-4533-4307-9B53-224DE2ED1FE6}" -Recurse -ErrorAction SilentlyContinue 466 | # Remove-Item -Path "HKCR:\Wow6432Node\CLSID\{018D5C66-4533-4307-9B53-224DE2ED1FE6}" -Recurse -ErrorAction SilentlyContinue 467 | 468 | # Install OneDrive 469 | # $onedrive = "$env:SYSTEMROOT\SysWOW64\OneDriveSetup.exe" 470 | # If (!(Test-Path $onedrive)) { 471 | # $onedrive = "$env:SYSTEMROOT\System32\OneDriveSetup.exe" 472 | # } 473 | # Start-Process $onedrive -NoNewWindow 474 | 475 | # Uninstall default Microsoft applications 476 | Write-Host "Uninstalling default Microsoft applications..." 477 | Get-AppxPackage "Microsoft.3DBuilder" | Remove-AppxPackage 478 | Get-AppxPackage "Microsoft.BingFinance" | Remove-AppxPackage 479 | Get-AppxPackage "Microsoft.BingNews" | Remove-AppxPackage 480 | Get-AppxPackage "Microsoft.BingSports" | Remove-AppxPackage 481 | Get-AppxPackage "Microsoft.BingWeather" | Remove-AppxPackage 482 | Get-AppxPackage "Microsoft.Getstarted" | Remove-AppxPackage 483 | Get-AppxPackage "Microsoft.MicrosoftOfficeHub" | Remove-AppxPackage 484 | Get-AppxPackage "Microsoft.MicrosoftSolitaireCollection" | Remove-AppxPackage 485 | # Get-AppxPackage "Microsoft.Office.OneNote" | Remove-AppxPackage 486 | Get-AppxPackage "Microsoft.People" | Remove-AppxPackage 487 | # Get-AppxPackage "Microsoft.SkypeApp" | Remove-AppxPackage 488 | Get-AppxPackage "Microsoft.Windows.Photos" | Remove-AppxPackage 489 | Get-AppxPackage "Microsoft.WindowsAlarms" | Remove-AppxPackage 490 | # Get-AppxPackage "Microsoft.WindowsCamera" | Remove-AppxPackage 491 | # Get-AppxPackage "microsoft.windowscommunicationsapps" | Remove-AppxPackage 492 | Get-AppxPackage "Microsoft.WindowsMaps" | Remove-AppxPackage 493 | Get-AppxPackage "Microsoft.WindowsPhone" | Remove-AppxPackage 494 | # Get-AppxPackage "Microsoft.WindowsSoundRecorder" | Remove-AppxPackage 495 | Get-AppxPackage "Microsoft.XboxApp" | Remove-AppxPackage 496 | Get-AppxPackage "Microsoft.ZuneMusic" | Remove-AppxPackage 497 | Get-AppxPackage "Microsoft.ZuneVideo" | Remove-AppxPackage 498 | # Get-AppxPackage "Microsoft.AppConnector" | Remove-AppxPackage 499 | # Get-AppxPackage "Microsoft.ConnectivityStore" | Remove-AppxPackage 500 | # Get-AppxPackage "Microsoft.Office.Sway" | Remove-AppxPackage 501 | # Get-AppxPackage "Microsoft.Messaging" | Remove-AppxPackage 502 | # Get-AppxPackage "Microsoft.CommsPhone" | Remove-AppxPackage 503 | # Get-AppxPackage "9E2F88E3.Twitter" | Remove-AppxPackage 504 | Get-AppxPackage "king.com.CandyCrushSodaSaga" | Remove-AppxPackage 505 | Get-AppxPackage "king.com.CandyCrushSaga" | Remove-AppxPackage 506 | Get-AppxPackage "king.com.CandyCrushFriends" | Remove-AppxPackage 507 | 508 | # Install default Microsoft applications 509 | # Add-AppxPackage -DisableDevelopmentMode -Register "$($(Get-AppXPackage -AllUsers "Microsoft.3DBuilder").InstallLocation)\AppXManifest.xml" 510 | # Add-AppxPackage -DisableDevelopmentMode -Register "$($(Get-AppXPackage -AllUsers "Microsoft.BingFinance").InstallLocation)\AppXManifest.xml" 511 | # Add-AppxPackage -DisableDevelopmentMode -Register "$($(Get-AppXPackage -AllUsers "Microsoft.BingNews").InstallLocation)\AppXManifest.xml" 512 | # Add-AppxPackage -DisableDevelopmentMode -Register "$($(Get-AppXPackage -AllUsers "Microsoft.BingSports").InstallLocation)\AppXManifest.xml" 513 | # Add-AppxPackage -DisableDevelopmentMode -Register "$($(Get-AppXPackage -AllUsers "Microsoft.BingWeather").InstallLocation)\AppXManifest.xml" 514 | # Add-AppxPackage -DisableDevelopmentMode -Register "$($(Get-AppXPackage -AllUsers "Microsoft.Getstarted").InstallLocation)\AppXManifest.xml" 515 | # Add-AppxPackage -DisableDevelopmentMode -Register "$($(Get-AppXPackage -AllUsers "Microsoft.MicrosoftOfficeHub").InstallLocation)\AppXManifest.xml" 516 | # Add-AppxPackage -DisableDevelopmentMode -Register "$($(Get-AppXPackage -AllUsers "Microsoft.MicrosoftSolitaireCollection").InstallLocation)\AppXManifest.xml" 517 | # Add-AppxPackage -DisableDevelopmentMode -Register "$($(Get-AppXPackage -AllUsers "Microsoft.Office.OneNote").InstallLocation)\AppXManifest.xml" 518 | # Add-AppxPackage -DisableDevelopmentMode -Register "$($(Get-AppXPackage -AllUsers "Microsoft.People").InstallLocation)\AppXManifest.xml" 519 | # Add-AppxPackage -DisableDevelopmentMode -Register "$($(Get-AppXPackage -AllUsers "Microsoft.SkypeApp").InstallLocation)\AppXManifest.xml" 520 | # Add-AppxPackage -DisableDevelopmentMode -Register "$($(Get-AppXPackage -AllUsers "Microsoft.Windows.Photos").InstallLocation)\AppXManifest.xml" 521 | # Add-AppxPackage -DisableDevelopmentMode -Register "$($(Get-AppXPackage -AllUsers "Microsoft.WindowsAlarms").InstallLocation)\AppXManifest.xml" 522 | # Add-AppxPackage -DisableDevelopmentMode -Register "$($(Get-AppXPackage -AllUsers "Microsoft.WindowsCamera").InstallLocation)\AppXManifest.xml" 523 | # Add-AppxPackage -DisableDevelopmentMode -Register "$($(Get-AppXPackage -AllUsers "Microsoft.windowscommunicationsapps").InstallLocation)\AppXManifest.xml" 524 | # Add-AppxPackage -DisableDevelopmentMode -Register "$($(Get-AppXPackage -AllUsers "Microsoft.WindowsMaps").InstallLocation)\AppXManifest.xml" 525 | # Add-AppxPackage -DisableDevelopmentMode -Register "$($(Get-AppXPackage -AllUsers "Microsoft.WindowsPhone").InstallLocation)\AppXManifest.xml" 526 | # Add-AppxPackage -DisableDevelopmentMode -Register "$($(Get-AppXPackage -AllUsers "Microsoft.WindowsSoundRecorder").InstallLocation)\AppXManifest.xml" 527 | # Add-AppxPackage -DisableDevelopmentMode -Register "$($(Get-AppXPackage -AllUsers "Microsoft.XboxApp").InstallLocation)\AppXManifest.xml" 528 | # Add-AppxPackage -DisableDevelopmentMode -Register "$($(Get-AppXPackage -AllUsers "Microsoft.ZuneMusic").InstallLocation)\AppXManifest.xml" 529 | # Add-AppxPackage -DisableDevelopmentMode -Register "$($(Get-AppXPackage -AllUsers "Microsoft.ZuneVideo").InstallLocation)\AppXManifest.xml" 530 | # Add-AppxPackage -DisableDevelopmentMode -Register "$($(Get-AppXPackage -AllUsers "Microsoft.AppConnector").InstallLocation)\AppXManifest.xml" 531 | # Add-AppxPackage -DisableDevelopmentMode -Register "$($(Get-AppXPackage -AllUsers "Microsoft.ConnectivityStore").InstallLocation)\AppXManifest.xml" 532 | # Add-AppxPackage -DisableDevelopmentMode -Register "$($(Get-AppXPackage -AllUsers "Microsoft.Office.Sway").InstallLocation)\AppXManifest.xml" 533 | # Add-AppxPackage -DisableDevelopmentMode -Register "$($(Get-AppXPackage -AllUsers "Microsoft.Messaging").InstallLocation)\AppXManifest.xml" 534 | # Add-AppxPackage -DisableDevelopmentMode -Register "$($(Get-AppXPackage -AllUsers "Microsoft.CommsPhone").InstallLocation)\AppXManifest.xml" 535 | # In case you have removed them for good, you can try to restore the files using installation medium as follows 536 | # New-Item C:\Mnt -Type Directory | Out-Null 537 | # dism /Mount-Image /ImageFile:D:\sources\install.wim /index:1 /ReadOnly /MountDir:C:\Mnt 538 | # robocopy /S /SEC /R:0 "C:\Mnt\Program Files\WindowsApps" "C:\Program Files\WindowsApps" 539 | # dism /Unmount-Image /Discard /MountDir:C:\Mnt 540 | # Remove-Item -Path C:\Mnt -Recurse 541 | 542 | # Uninstall Windows Media Player 543 | # Write-Host "Uninstalling Windows Media Player..." 544 | # dism /online /Disable-Feature /FeatureName:MediaPlayback /Quiet /NoRestart 545 | 546 | # Install Windows Media Player 547 | # dism /online /Enable-Feature /FeatureName:MediaPlayback /Quiet /NoRestart 548 | 549 | # Uninstall Work Folders Client 550 | # Write-Host "Uninstalling Work Folders Client..." 551 | # dism /online /Disable-Feature /FeatureName:WorkFolders-Client /Quiet /NoRestart 552 | 553 | # Install Work Folders Client 554 | # dism /online /Enable-Feature /FeatureName:WorkFolders-Client /Quiet /NoRestart 555 | 556 | # Set Photo Viewer as default for bmp, gif, jpg and png 557 | Write-Host "Setting Photo Viewer as default for bmp, gif, jpg, png and tif..." 558 | If (!(Test-Path "HKCR:")) { 559 | New-PSDrive -Name HKCR -PSProvider Registry -Root HKEY_CLASSES_ROOT | Out-Null 560 | } 561 | ForEach ($type in @("Paint.Picture", "giffile", "jpegfile", "pngfile")) { 562 | New-Item -Path $("HKCR:\$type\shell\open") -Force | Out-Null 563 | New-Item -Path $("HKCR:\$type\shell\open\command") | Out-Null 564 | Set-ItemProperty -Path $("HKCR:\$type\shell\open") -Name "MuiVerb" -Type ExpandString -Value "@%ProgramFiles%\Windows Photo Viewer\photoviewer.dll,-3043" 565 | 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" 566 | } 567 | 568 | # Remove or reset default open action for bmp, gif, jpg and png 569 | # If (!(Test-Path "HKCR:")) { 570 | # New-PSDrive -Name HKCR -PSProvider Registry -Root HKEY_CLASSES_ROOT | Out-Null 571 | # } 572 | # Remove-Item -Path "HKCR:\Paint.Picture\shell\open" -Recurse 573 | # Remove-ItemProperty -Path "HKCR:\giffile\shell\open" -Name "MuiVerb" 574 | # Set-ItemProperty -Path "HKCR:\giffile\shell\open" -Name "CommandId" -Type String -Value "IE.File" 575 | # Set-ItemProperty -Path "HKCR:\giffile\shell\open\command" -Name "(Default)" -Type String -Value "`"$env:SystemDrive\Program Files\Internet Explorer\iexplore.exe`" %1" 576 | # Set-ItemProperty -Path "HKCR:\giffile\shell\open\command" -Name "DelegateExecute" -Type String -Value "{17FE9752-0B5A-4665-84CD-569794602F5C}" 577 | # Remove-Item -Path "HKCR:\jpegfile\shell\open" -Recurse 578 | # Remove-Item -Path "HKCR:\pngfile\shell\open" -Recurse 579 | 580 | # Show Photo Viewer in "Open with..." 581 | Write-Host "Showing Photo Viewer in `"Open with...`"" 582 | If (!(Test-Path "HKCR:")) { 583 | New-PSDrive -Name HKCR -PSProvider Registry -Root HKEY_CLASSES_ROOT | Out-Null 584 | } 585 | New-Item -Path "HKCR:\Applications\photoviewer.dll\shell\open\command" -Force | Out-Null 586 | New-Item -Path "HKCR:\Applications\photoviewer.dll\shell\open\DropTarget" -Force | Out-Null 587 | Set-ItemProperty -Path "HKCR:\Applications\photoviewer.dll\shell\open" -Name "MuiVerb" -Type String -Value "@photoviewer.dll,-3043" 588 | 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" 589 | Set-ItemProperty -Path "HKCR:\Applications\photoviewer.dll\shell\open\DropTarget" -Name "Clsid" -Type String -Value "{FFE2A43C-56B9-4bf5-9A79-CC6D4285608A}" 590 | 591 | # Remove Photo Viewer from "Open with..." 592 | # If (!(Test-Path "HKCR:")) { 593 | # New-PSDrive -Name HKCR -PSProvider Registry -Root HKEY_CLASSES_ROOT | Out-Null 594 | # } 595 | # Remove-Item -Path "HKCR:\Applications\photoviewer.dll\shell\open" -Recurse 596 | 597 | } 598 | 599 | # Uploads a default layout to all NEW users that log into the system. Effects task bar and start menu 600 | function LayoutDesign { 601 | If (!([Security.Principal.WindowsPrincipal][Security.Principal.WindowsIdentity]::GetCurrent()).IsInRole([Security.Principal.WindowsBuiltInRole]"Administrator")) { 602 | Start-Process powershell.exe "-NoProfile -ExecutionPolicy Bypass -File `"$PSCommandPath`"" -Verb RunAs 603 | Exit 604 | } 605 | Import-StartLayout -LayoutPath "c:\build\PC-Build-Script-master\LayoutModification.xml" -MountPath $env:SystemDrive\ 606 | } 607 | 608 | function ApplyDefaultApps { 609 | dism /online /Import-DefaultAppAssociations:c:\build\PC-Build-Script-master\AppAssociations.xml 610 | } 611 | 612 | # Custom power profile used for our customers. Ensures systems do not go to sleep. 613 | function IntechPower { 614 | POWERCFG -DUPLICATESCHEME 381b4222-f694-41f0-9685-ff5bb260df2e 381b4222-f694-41f0-9685-ff5bb260aaaa 615 | POWERCFG -CHANGENAME 381b4222-f694-41f0-9685-ff5bb260aaaa "Intech Power Management" 616 | POWERCFG -SETACTIVE 381b4222-f694-41f0-9685-ff5bb260aaaa 617 | POWERCFG -Change -monitor-timeout-ac 15 618 | POWERCFG -CHANGE -monitor-timeout-dc 5 619 | POWERCFG -CHANGE -disk-timeout-ac 30 620 | POWERCFG -CHANGE -disk-timeout-dc 5 621 | POWERCFG -CHANGE -standby-timeout-ac 0 622 | POWERCFG -CHANGE -standby-timeout-dc 30 623 | POWERCFG -CHANGE -hibernate-timeout-ac 0 624 | POWERCFG -CHANGE -hibernate-timeout-dc 0 625 | } 626 | 627 | function RestartPC{ 628 | ########## 629 | # Restart 630 | ########## 631 | Write-Host 632 | Write-Host "Press any key to restart your system..." -ForegroundColor Black -BackgroundColor White 633 | $key = $host.UI.RawUI.ReadKey("NoEcho,IncludeKeyDown") 634 | Write-Host "Restarting..." 635 | Restart-Computer 636 | } 637 | 638 | function Branding{ 639 | Invoke-WebRequest -Uri "https://downloads.pacit.tech/intechlogo.bmp" -OutFile "c:\windows\system32\intechlogo.bmp" 640 | New-ItemProperty -Path "HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\OEMInformation" -Name "Manufacturer" -Value "Intech I.T. Solutions Ltd" -PropertyType "String" -Force 641 | } 642 | 643 | InstallChoco 644 | InstallApps 645 | #ReclaimWindows10 646 | #LayoutDesign 647 | #ApplyDefaultApps 648 | IntechPower 649 | Branding 650 | #SetPCName 651 | RestartPC 652 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # PC Build Script 2 | 3 | Recommended install process; 4 | 5 | - Run a clean installation of Windows. 6 | - Disable UAC until the script is completed. 7 | - Copy RunMe.bat and download.ps1 to a USB and run the RunMe.bat file. 8 | - The .bat will run the download.ps1 file which downloads the latest version of the PC setup script on GitHub, then automatically triggers the script. 9 | 10 | # Customizing The Script 11 | **You shoud review the PCSetup.ps1 file before running this script. You may wish to fork this repository and customise it to fit your requirements.** 12 | 13 | By default this script will do the following: 14 | 15 | - Install Chocolatey 16 | - Install Adobe PDF reader 17 | - Install 7zip 18 | - Install the new Chromium based Microsoft Edge 19 | - Install Microsoft Office 365 Business Retail 64bit (The standard version that works with Microsoft 365 Basic) 20 | - Apply a custom layout to the task bar and start menu (removes the search bar, app store and Mail icons. 21 | **- Runs a reclaim windows script. You will want to review these settings and customise them. for the most part the defaults are not offensive, but they are worth reviewing.** 22 | - Applies changes to the default apps across the whole system for all users. You can custommise these defaults by editing AppAssociations.xml 23 | - Applies a customer power profile to the system which ensures that whilst the screen turns off, the system does not go to sleep when plugged into power ... ever 24 | - Prompts for a PC Name. **You may want to customise this section** as it is currently configured to a naming convention we use at our MSP which may not suit your needs. 25 | - Restarts the system. 26 | 27 | # Contributions and recognition 28 | I cannot claim full reponsibility for this work. Some of the functions were found by trawling through the interwebs. Unfortunately I didn't keep a record of the sources as originally this was for internal use only, but for anyone who recognises some of their work, **thank you!** I will aim to update and credit you here if I find you in the future. 29 | 30 | # Pull Requests 31 | If you have any updates or improvements, please submit a pull request. 32 | 33 | # Disclaimer 34 | I cannot be held liable for the use of this script, or any unintended side effects caused by using it. Use of this script is entirely at your own risk. Please fully test on a non-production system prior to using it on end user / customer systems. 35 | 36 | During development I created a dummy virtual machine which I could snapshot, rinse and repeat for testing. I suggest you do the same whilst testing your own forked version. -------------------------------------------------------------------------------- /RunMe.bat: -------------------------------------------------------------------------------- 1 | REM Create a directory on the C drive to store the scripts from the repository 2 | mkdir c:\build 3 | REM Enable execution policy to allow running of scripts 4 | Powershell.exe -Command "& {Start-Process Powershell.exe -ArgumentList 'set-executionpolicy remotesigned' -Verb RunAs}" 5 | REM Download the most up to date version of the script from the repository. download.ps1 must be in the same directory as RunMe.bat 6 | powershell.exe -ExecutionPolicy Bypass -noprofile -command "&{start-process powershell -ArgumentList '-noprofile -file \"%~dp0download.ps1\"' -verb RunAs}" 7 | REM The download.ps1 auto extracts the contents to c:\build. Wait 10 seconds for this to complete before executing the PCSetup.ps1 script 8 | timeout 10 9 | REM Execute the final build script 10 | powershell.exe -ExecutionPolicy Bypass -noprofile -command "&{start-process powershell -ArgumentList '-noprofile -file \"c:\build\PC-Build-Script-master\PCSetup.ps1\"' -verb RunAs}" 11 | -------------------------------------------------------------------------------- /download.ps1: -------------------------------------------------------------------------------- 1 | Set-ExecutionPolicy remotesigned 2 | function downloadbuilder { 3 | Invoke-WebRequest -Uri "https://github.com/matstocks/PC-Build-Script/archive/master.zip" -OutFile "C:\build\PCBuild.zip" 4 | Expand-Archive C:\build\PCBuild.zip -DestinationPath C:\build\ 5 | } 6 | downloadbuilder --------------------------------------------------------------------------------