Advertisement
spastek

SudoYETI-DeCrapify-Edit

Apr 13th, 2022
793
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. ##########
  2. # Win10 Initial Setup Script
  3. # Author: Disassembler <disassembler@dasm.cz>
  4. # Version: 1.4, 2016-01-16
  5. ##########
  6.  
  7. # Ask for elevated permissions if required
  8. If (!([Security.Principal.WindowsPrincipal][Security.Principal.WindowsIdentity]::GetCurrent()).IsInRole([Security.Principal.WindowsBuiltInRole]"Administrator")) {
  9.     Start-Process powershell.exe "-NoProfile -ExecutionPolicy Bypass -File `"$PSCommandPath`"" -Verb RunAs
  10.     Exit
  11. }
  12.  
  13.  
  14.  
  15. ##########
  16. # Privacy Settings
  17. ##########
  18.  
  19. # Disable Telemetry
  20. Write-Host "Disabling Telemetry..."
  21. Set-ItemProperty -Path "HKLM:\Software\Policies\Microsoft\Windows\DataCollection" -Name "AllowTelemetry" -Type DWord -Value 0
  22.  
  23. # Enable Telemetry
  24. # Remove-ItemProperty -Path "HKLM:\Software\Policies\Microsoft\Windows\DataCollection" -Name "AllowTelemetry"
  25.  
  26. # Disable Wi-Fi Sense
  27. Write-Host "Disabling Wi-Fi Sense..."
  28. If (!(Test-Path "HKLM:\Software\Microsoft\PolicyManager\default\WiFi\AllowWiFiHotSpotReporting")) {
  29.     New-Item -Path "HKLM:\Software\Microsoft\PolicyManager\default\WiFi\AllowWiFiHotSpotReporting" -Force | Out-Null
  30. }
  31. Set-ItemProperty -Path "HKLM:\Software\Microsoft\PolicyManager\default\WiFi\AllowWiFiHotSpotReporting" -Name "Value" -Type DWord -Value 0
  32. Set-ItemProperty -Path "HKLM:\Software\Microsoft\PolicyManager\default\WiFi\AllowAutoConnectToWiFiSenseHotspots" -Name "Value" -Type DWord -Value 0
  33.  
  34. # Enable Wi-Fi Sense
  35. # Set-ItemProperty -Path "HKLM:\Software\Microsoft\PolicyManager\default\WiFi\AllowWiFiHotSpotReporting" -Name "Value" -Type DWord -Value 1
  36. # Set-ItemProperty -Path "HKLM:\Software\Microsoft\PolicyManager\default\WiFi\AllowAutoConnectToWiFiSenseHotspots" -Name "Value" -Type DWord -Value 1
  37.  
  38. # Disable SmartScreen Filter
  39. Write-Host "Disabling SmartScreen Filter..."
  40. Set-ItemProperty -Path "HKLM:\Software\Microsoft\Windows\CurrentVersion\Explorer" -Name "SmartScreenEnabled" -Type String -Value "Off"
  41. Set-ItemProperty -Path "HKCU:\Software\Microsoft\Windows\CurrentVersion\AppHost" -Name "EnableWebContentEvaluation" -Type DWord -Value 0
  42.  
  43. # Enable SmartScreen Filter
  44. # Set-ItemProperty -Path "HKLM:\Software\Microsoft\Windows\CurrentVersion\Explorer" -Name "SmartScreenEnabled" -Type String -Value "RequireAdmin"
  45. # Remove-ItemProperty -Path "HKCU:\Software\Microsoft\Windows\CurrentVersion\AppHost" -Name "EnableWebContentEvaluation"
  46.  
  47. # Disable Bing Search in Start Menu
  48. Write-Host "Disabling Bing Search in Start Menu..."
  49. Set-ItemProperty -Path "HKCU:\Software\Microsoft\Windows\CurrentVersion\Search" -Name "BingSearchEnabled" -Type DWord -Value 0
  50.  
  51. # Enable Bing Search in Start Menu
  52. # Remove-ItemProperty -Path "HKCU:\Software\Microsoft\Windows\CurrentVersion\Search" -Name "BingSearchEnabled"
  53.  
  54. # Disable Location Tracking
  55. Write-Host "Disabling Location Tracking..."
  56. Set-ItemProperty -Path "HKLM:\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Sensor\Overrides\{BFA794E4-F964-4FDB-90F6-51056BFE4B44}" -Name "SensorPermissionState" -Type DWord -Value 0
  57. Set-ItemProperty -Path "HKLM:\System\CurrentControlSet\Services\lfsvc\Service\Configuration" -Name "Status" -Type DWord -Value 0
  58.  
  59. # Enable Location Tracking
  60. # Set-ItemProperty -Path "HKLM:\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Sensor\Overrides\{BFA794E4-F964-4FDB-90F6-51056BFE4B44}" -Name "SensorPermissionState" -Type DWord -Value 1
  61. # Set-ItemProperty -Path "HKLM:\System\CurrentControlSet\Services\lfsvc\Service\Configuration" -Name "Status" -Type DWord -Value 1
  62.  
  63. # Disable Feedback
  64. Write-Host "Disabling Feedback..."
  65. If (!(Test-Path "HKCU:\Software\Microsoft\Siuf\Rules")) {
  66.     New-Item -Path "HKCU:\Software\Microsoft\Siuf\Rules" -Force | Out-Null
  67. }
  68. Set-ItemProperty -Path "HKCU:\Software\Microsoft\Siuf\Rules" -Name "NumberOfSIUFInPeriod" -Type DWord -Value 0
  69.  
  70. # Enable Feedback
  71. # Remove-ItemProperty -Path "HKCU:\Software\Microsoft\Siuf\Rules" -Name "NumberOfSIUFInPeriod"
  72.  
  73. # Disable Advertising ID
  74. Write-Host "Disabling Advertising ID..."
  75. If (!(Test-Path "HKCU:\Software\Microsoft\Windows\CurrentVersion\AdvertisingInfo")) {
  76.     New-Item -Path "HKCU:\Software\Microsoft\Windows\CurrentVersion\AdvertisingInfo" | Out-Null
  77. }
  78. Set-ItemProperty -Path "HKCU:\Software\Microsoft\Windows\CurrentVersion\AdvertisingInfo" -Name "Enabled" -Type DWord -Value 0
  79.  
  80. # Enable Advertising ID
  81. # Remove-ItemProperty -Path "HKCU:\Software\Microsoft\Windows\CurrentVersion\AdvertisingInfo" -Name "Enabled"
  82.  
  83. # Disable Cortana
  84. Write-Host "Disabling Cortana..."
  85. If (!(Test-Path "HKCU:\Software\Microsoft\Personalization\Settings")) {
  86.     New-Item -Path "HKCU:\Software\Microsoft\Personalization\Settings" -Force | Out-Null
  87. }
  88. Set-ItemProperty -Path "HKCU:\Software\Microsoft\Personalization\Settings" -Name "AcceptedPrivacyPolicy" -Type DWord -Value 0
  89. If (!(Test-Path "HKCU:\Software\Microsoft\InputPersonalization")) {
  90.     New-Item -Path "HKCU:\Software\Microsoft\InputPersonalization" -Force | Out-Null
  91. }
  92. Set-ItemProperty -Path "HKCU:\Software\Microsoft\InputPersonalization" -Name "RestrictImplicitTextCollection" -Type DWord -Value 1
  93. Set-ItemProperty -Path "HKCU:\Software\Microsoft\InputPersonalization" -Name "RestrictImplicitInkCollection" -Type DWord -Value 1
  94. If (!(Test-Path "HKCU:\Software\Microsoft\InputPersonalization\TrainedDataStore")) {
  95.     New-Item -Path "HKCU:\Software\Microsoft\InputPersonalization\TrainedDataStore" -Force | Out-Null
  96. }
  97. Set-ItemProperty -Path "HKCU:\Software\Microsoft\InputPersonalization\TrainedDataStore" -Name "HarvestContacts" -Type DWord -Value 0
  98.  
  99. # Enable Cortana
  100. # Remove-ItemProperty -Path "HKCU:\Software\Microsoft\Personalization\Settings" -Name "AcceptedPrivacyPolicy"
  101. # Set-ItemProperty -Path "HKCU:\Software\Microsoft\InputPersonalization" -Name "RestrictImplicitTextCollection" -Type DWord -Value 0
  102. # Set-ItemProperty -Path "HKCU:\Software\Microsoft\InputPersonalization" -Name "RestrictImplicitInkCollection" -Type DWord -Value 0
  103. # Remove-ItemProperty -Path "HKCU:\Software\Microsoft\InputPersonalization\TrainedDataStore" -Name "HarvestContacts"
  104.  
  105. # Restrict Windows Update P2P only to local network
  106. Write-Host "Restricting Windows Update P2P only to local network..."
  107. Set-ItemProperty -Path "HKLM:\Software\Microsoft\Windows\CurrentVersion\DeliveryOptimization\Config" -Name "DODownloadMode" -Type DWord -Value 1
  108. If (!(Test-Path "HKCU:\Software\Microsoft\Windows\CurrentVersion\DeliveryOptimization")) {
  109.     New-Item -Path "HKCU:\Software\Microsoft\Windows\CurrentVersion\DeliveryOptimization" | Out-Null
  110. }
  111. Set-ItemProperty -Path "HKCU:\Software\Microsoft\Windows\CurrentVersion\DeliveryOptimization" -Name "SystemSettingsDownloadMode" -Type DWord -Value 3
  112.  
  113. # Unrestrict Windows Update P2P
  114. # Remove-ItemProperty -Path "HKLM:\Software\Microsoft\Windows\CurrentVersion\DeliveryOptimization\Config" -Name "DODownloadMode"
  115. # Remove-ItemProperty -Path "HKCU:\Software\Microsoft\Windows\CurrentVersion\DeliveryOptimization" -Name "SystemSettingsDownloadMode"
  116.  
  117. # Remove AutoLogger file and restrict directory
  118. Write-Host "Removing AutoLogger file and restricting directory..."
  119. $autoLoggerDir = "$env:PROGRAMDATA\Microsoft\Diagnosis\ETLLogs\AutoLogger"
  120. If (Test-Path "$autoLoggerDir\AutoLogger-Diagtrack-Listener.etl") {
  121.     Remove-Item "$autoLoggerDir\AutoLogger-Diagtrack-Listener.etl"
  122. }
  123. icacls $autoLoggerDir /deny SYSTEM:`(OI`)`(CI`)F | Out-Null
  124.  
  125. # Unrestrict AutoLogger directory
  126. # $autoLoggerDir = "$env:PROGRAMDATA\Microsoft\Diagnosis\ETLLogs\AutoLogger"
  127. # icacls $autoLoggerDir /grant:r SYSTEM:`(OI`)`(CI`)F | Out-Null
  128.  
  129. # Stop and disable Diagnostics Tracking Service
  130. Write-Host "Stopping and disabling Diagnostics Tracking Service..."
  131. Stop-Service "DiagTrack"
  132. Set-Service "DiagTrack" -StartupType Disabled
  133.  
  134. # Enable and start Diagnostics Tracking Service
  135. # Set-Service "DiagTrack" -StartupType Automatic
  136. # Start-Service "DiagTrack"
  137.  
  138. ##########
  139. # Service Tweaks
  140. ##########
  141.  
  142. # Lower UAC level
  143. # Write-Host "Lowering UAC level..."
  144. # Set-ItemProperty -Path "HKLM:\Software\Microsoft\Windows\CurrentVersion\Policies\System" -Name "ConsentPromptBehaviorAdmin" -Type DWord -Value 0
  145. # Set-ItemProperty -Path "HKLM:\Software\Microsoft\Windows\CurrentVersion\Policies\System" -Name "PromptOnSecureDesktop" -Type DWord -Value 0
  146.  
  147. # Raise UAC level
  148. # Set-ItemProperty -Path "HKLM:\Software\Microsoft\Windows\CurrentVersion\Policies\System" -Name "ConsentPromptBehaviorAdmin" -Type DWord -Value 5
  149. # Set-ItemProperty -Path "HKLM:\Software\Microsoft\Windows\CurrentVersion\Policies\System" -Name "PromptOnSecureDesktop" -Type DWord -Value 1
  150.  
  151. # Enable sharing mapped drives between users
  152. # Write-Host "Enabling sharing mapped drives between users..."
  153. # Set-ItemProperty -Path "HKLM:\Software\Microsoft\Windows\CurrentVersion\Policies\System" -Name "EnableLinkedConnections" -Type DWord -Value 1
  154.  
  155. # Disable sharing mapped drives between users
  156. # Remove-ItemProperty -Path "HKLM:\Software\Microsoft\Windows\CurrentVersion\Policies\System" -Name "EnableLinkedConnections"
  157.  
  158. # Disable Firewall
  159. # Write-Host "Disabling Firewall..."
  160. # Set-NetFirewallProfile -Profile * -Enabled False
  161.  
  162. # Enable Firewall
  163. # Set-NetFirewallProfile -Profile * -Enabled True
  164.  
  165. # Disable Windows Defender
  166. # Write-Host "Disabling Windows Defender..."
  167. # Set-ItemProperty -Path "HKLM:\Software\Policies\Microsoft\Windows Defender" -Name "DisableAntiSpyware" -Type DWord -Value 1
  168.  
  169. # Enable Windows Defender
  170. # Remove-ItemProperty -Path "HKLM:\Software\Policies\Microsoft\Windows Defender" -Name "DisableAntiSpyware"
  171.  
  172. # Disable Windows Update automatic restart
  173. Write-Host "Disabling Windows Update automatic restart..."
  174. Set-ItemProperty -Path "HKLM:\Software\Microsoft\WindowsUpdate\UX\Settings" -Name "UxOption" -Type DWord -Value 1
  175.  
  176. # Enable Windows Update automatic restart
  177. # Set-ItemProperty -Path "HKLM:\Software\Microsoft\WindowsUpdate\UX\Settings" -Name "UxOption" -Type DWord -Value 0
  178.  
  179. # Stop and disable Home Groups services
  180. Write-Host "Stopping and disabling Home Groups services..."
  181. Stop-Service "HomeGroupListener"
  182. Set-Service "HomeGroupListener" -StartupType Disabled
  183. Stop-Service "HomeGroupProvider"
  184. Set-Service "HomeGroupProvider" -StartupType Disabled
  185.  
  186. # Enable and start Home Groups services
  187. # Set-Service "HomeGroupListener" -StartupType Manual
  188. # Set-Service "HomeGroupProvider" -StartupType Manual
  189. # Start-Service "HomeGroupProvider"
  190.  
  191. # Disable Remote Assistance
  192. # Write-Host "Disabling Remote Assistance..."
  193. # Set-ItemProperty -Path "HKLM:\System\CurrentControlSet\Control\Remote Assistance" -Name "fAllowToGetHelp" -Type DWord -Value 0
  194.  
  195. # Enable Remote Assistance
  196. # Set-ItemProperty -Path "HKLM:\System\CurrentControlSet\Control\Remote Assistance" -Name "fAllowToGetHelp" -Type DWord -Value 1
  197.  
  198. # Enable Remote Desktop w/o Network Level Authentication
  199. # Write-Host "Enabling Remote Desktop w/o Network Level Authentication..."
  200. # Set-ItemProperty -Path "HKLM:\System\CurrentControlSet\Control\Terminal Server" -Name "fDenyTSConnections" -Type DWord -Value 0
  201. # Set-ItemProperty -Path "HKLM:\System\CurrentControlSet\Control\Terminal Server\WinStations\RDP-Tcp" -Name "UserAuthentication" -Type DWord -Value 0
  202.  
  203. # Disable Remote Desktop
  204. # Set-ItemProperty -Path "HKLM:\System\CurrentControlSet\Control\Terminal Server" -Name "fDenyTSConnections" -Type DWord -Value 1
  205. # Set-ItemProperty -Path "HKLM:\System\CurrentControlSet\Control\Terminal Server\WinStations\RDP-Tcp" -Name "UserAuthentication" -Type DWord -Value 1
  206.  
  207. ##########
  208. # UI Tweaks
  209. ##########
  210.  
  211. # Disable Action Center
  212. # Write-Host "Disabling Action Center..."
  213. # If (!(Test-Path "HKCU:\Software\Policies\Microsoft\Windows\Explorer")) {
  214. #   New-Item -Path "HKCU:\Software\Policies\Microsoft\Windows\Explorer" | Out-Null
  215. # }
  216. # Set-ItemProperty -Path "HKCU:\Software\Policies\Microsoft\Windows\Explorer" -Name "DisableNotificationCenter" -Type DWord -Value 1
  217. # Set-ItemProperty -Path "HKCU:\Software\Microsoft\Windows\CurrentVersion\PushNotifications" -Name "ToastEnabled" -Type DWord -Value 0
  218.  
  219. # Enable Action Center
  220. # Remove-ItemProperty -Path "HKCU:\Software\Policies\Microsoft\Windows\Explorer" -Name "DisableNotificationCenter"
  221. # Remove-ItemProperty -Path "HKCU:\Software\Microsoft\Windows\CurrentVersion\PushNotifications" -Name "ToastEnabled"
  222.  
  223. # Disable Lock screen
  224. # Write-Host "Disabling Lock screen..."
  225. # If (!(Test-Path "HKLM:\Software\Policies\Microsoft\Windows\Personalization")) {
  226. #   New-Item -Path "HKLM:\Software\Policies\Microsoft\Windows\Personalization" | Out-Null
  227. # }
  228. # Set-ItemProperty -Path "HKLM:\Software\Policies\Microsoft\Windows\Personalization" -Name "NoLockScreen" -Type DWord -Value 1
  229.  
  230. # Enable Lock screen
  231. # Remove-ItemProperty -Path "HKLM:\Software\Policies\Microsoft\Windows\Personalization" -Name "NoLockScreen"
  232.  
  233. # Disable Autoplay
  234.  Write-Host "Disabling Autoplay..."
  235.  Set-ItemProperty -Path "HKCU:\Software\Microsoft\Windows\CurrentVersion\Explorer\AutoplayHandlers" -Name "DisableAutoplay" -Type DWord -Value 1
  236.  
  237. # Enable Autoplay
  238. # Set-ItemProperty -Path "HKCU:\Software\Microsoft\Windows\CurrentVersion\Explorer\AutoplayHandlers" -Name "DisableAutoplay" -Type DWord -Value 0
  239.  
  240. # Disable Autorun for all drives
  241.  Write-Host "Disabling Autorun for all drives..."
  242.  If (!(Test-Path "HKCU:\Software\Microsoft\Windows\CurrentVersion\Policies\Explorer")) {
  243.     New-Item -Path "HKCU:\Software\Microsoft\Windows\CurrentVersion\Policies\Explorer" | Out-Null
  244. }
  245.  Set-ItemProperty -Path "HKCU:\Software\Microsoft\Windows\CurrentVersion\Policies\Explorer" -Name "NoDriveTypeAutoRun" -Type DWord -Value 255
  246.  
  247. # Enable Autorun
  248. # Remove-ItemProperty -Path "HKCU:\Software\Microsoft\Windows\CurrentVersion\Policies\Explorer" -Name "NoDriveTypeAutoRun"
  249.  
  250. # Disable Sticky keys prompt
  251.  Write-Host "Disabling Sticky keys prompt..."
  252.  Set-ItemProperty -Path "HKCU:\Control Panel\Accessibility\StickyKeys" -Name "Flags" -Type String -Value "506"
  253.  
  254. # Enable Sticky keys prompt
  255. # Set-ItemProperty -Path "HKCU:\Control Panel\Accessibility\StickyKeys" -Name "Flags" -Type String -Value "510"
  256.  
  257. # Hide Search button / box
  258.  Write-Host "Hiding Search Box / Button..."
  259.  Set-ItemProperty -Path "HKCU:\Software\Microsoft\Windows\CurrentVersion\Search" -Name "SearchboxTaskbarMode" -Type DWord -Value 0
  260.  
  261. # Show Search button / box
  262. # Remove-ItemProperty -Path "HKCU:\Software\Microsoft\Windows\CurrentVersion\Search" -Name "SearchboxTaskbarMode"
  263.  
  264. # Hide Task View button
  265. # Write-Host "Hiding Task View button..."
  266. # Set-ItemProperty -Path "HKCU:\Software\Microsoft\Windows\CurrentVersion\Explorer\Advanced" -Name "ShowTaskViewButton" -Type DWord -Value 0
  267.  
  268. # Show Task View button
  269.  Remove-ItemProperty -Path "HKCU:\Software\Microsoft\Windows\CurrentVersion\Explorer\Advanced" -Name "ShowTaskViewButton"
  270.  
  271. # Show small icons in taskbar
  272.  Write-Host "Showing small icons in taskbar..."
  273.  Set-ItemProperty -Path "HKCU:\Software\Microsoft\Windows\CurrentVersion\Explorer\Advanced" -Name "TaskbarSmallIcons" -Type DWord -Value 1
  274.  
  275. # Show large icons in taskbar
  276. # Remove-ItemProperty -Path "HKCU:\Software\Microsoft\Windows\CurrentVersion\Explorer\Advanced" -Name "TaskbarSmallIcons"
  277.  
  278. # Show titles in taskbar
  279. # Write-Host "Showing titles in taskbar..."
  280. # Set-ItemProperty -Path "HKCU:\Software\Microsoft\Windows\CurrentVersion\Explorer\Advanced" -Name "TaskbarGlomLevel" -Type DWord -Value 1
  281.  
  282. # Hide titles in taskbar
  283. Remove-ItemProperty -Path "HKCU:\Software\Microsoft\Windows\CurrentVersion\Explorer\Advanced" -Name "TaskbarGlomLevel"
  284.  
  285. # Show all tray icons
  286. Write-Host "Showing all tray icons..."
  287. Set-ItemProperty -Path "HKCU:\Software\Microsoft\Windows\CurrentVersion\Explorer" -Name "EnableAutoTray" -Type DWord -Value 0
  288.  
  289. # Hide tray icons as needed
  290. # Remove-ItemProperty -Path "HKCU:\Software\Microsoft\Windows\CurrentVersion\Explorer" -Name "EnableAutoTray"
  291.  
  292. # Show known file extensions
  293. Write-Host "Showing known file extensions..."
  294. Set-ItemProperty -Path "HKCU:\Software\Microsoft\Windows\CurrentVersion\Explorer\Advanced" -Name "HideFileExt" -Type DWord -Value 0
  295.  
  296. # Hide known file extensions
  297. # Set-ItemProperty -Path "HKCU:\Software\Microsoft\Windows\CurrentVersion\Explorer\Advanced" -Name "HideFileExt" -Type DWord -Value 1
  298.  
  299. # Show hidden files
  300.  Write-Host "Showing hidden files..."
  301.  Set-ItemProperty -Path "HKCU:\Software\Microsoft\Windows\CurrentVersion\Explorer\Advanced" -Name "Hidden" -Type DWord -Value 1
  302.  
  303. # Hide hidden files
  304. # Set-ItemProperty -Path "HKCU:\Software\Microsoft\Windows\CurrentVersion\Explorer\Advanced" -Name "Hidden" -Type DWord -Value 2
  305.  
  306. # Change default Explorer view to "Computer"
  307. Write-Host "Changing default Explorer view to `"Computer`"..."
  308. Set-ItemProperty -Path "HKCU:\Software\Microsoft\Windows\CurrentVersion\Explorer\Advanced" -Name "LaunchTo" -Type DWord -Value 1
  309.  
  310. # Change default Explorer view to "Quick Access"
  311. # Remove-ItemProperty -Path "HKCU:\Software\Microsoft\Windows\CurrentVersion\Explorer\Advanced" -Name "LaunchTo"
  312.  
  313. # Show Computer shortcut on desktop
  314. # Write-Host "Showing Computer shortcut on desktop..."
  315. # If (!(Test-Path "HKCU:\Software\Microsoft\Windows\CurrentVersion\Explorer\HideDesktopIcons\ClassicStartMenu")) {
  316. #   New-Item -Path "HKCU:\Software\Microsoft\Windows\CurrentVersion\Explorer\HideDesktopIcons\ClassicStartMenu" | Out-Null
  317. # }
  318. # Set-ItemProperty -Path "HKCU:\Software\Microsoft\Windows\CurrentVersion\Explorer\HideDesktopIcons\ClassicStartMenu" -Name "{20D04FE0-3AEA-1069-A2D8-08002B30309D}" -Type DWord -Value 0
  319. # Set-ItemProperty -Path "HKCU:\Software\Microsoft\Windows\CurrentVersion\Explorer\HideDesktopIcons\NewStartPanel" -Name "{20D04FE0-3AEA-1069-A2D8-08002B30309D}" -Type DWord -Value 0
  320.  
  321. # Hide Computer shortcut from desktop
  322. # Remove-ItemProperty -Path "HKCU:\Software\Microsoft\Windows\CurrentVersion\Explorer\HideDesktopIcons\ClassicStartMenu" -Name "{20D04FE0-3AEA-1069-A2D8-08002B30309D}"
  323. # Remove-ItemProperty -Path "HKCU:\Software\Microsoft\Windows\CurrentVersion\Explorer\HideDesktopIcons\NewStartPanel" -Name "{20D04FE0-3AEA-1069-A2D8-08002B30309D}"
  324.  
  325. # Remove Desktop icon from computer namespace
  326.  Write-Host "Removing Desktop icon from computer namespace..."
  327.  Remove-Item -Path "HKLM:\Software\Microsoft\Windows\CurrentVersion\Explorer\MyComputer\NameSpace\{B4BFCC3A-DB2C-424C-B029-7FE99A87C641}" -Recurse -ErrorAction SilentlyContinue
  328.  
  329. # Add Desktop icon to computer namespace
  330. # New-Item -Path "HKLM:\Software\Microsoft\Windows\CurrentVersion\Explorer\MyComputer\NameSpace\{B4BFCC3A-DB2C-424C-B029-7FE99A87C641}"
  331.  
  332. # Remove Documents icon from computer namespace
  333. # Write-Host "Removing Documents icon from computer namespace..."
  334. # Remove-Item -Path "HKLM:\Software\Microsoft\Windows\CurrentVersion\Explorer\MyComputer\NameSpace\{d3162b92-9365-467a-956b-92703aca08af}" -Recurse -ErrorAction SilentlyContinue
  335. # Remove-Item -Path "HKLM:\Software\Microsoft\Windows\CurrentVersion\Explorer\MyComputer\NameSpace\{A8CDFF1C-4878-43be-B5FD-F8091C1C60D0}" -Recurse -ErrorAction SilentlyContinue
  336.  
  337. # Add Documents icon to computer namespace
  338. # New-Item -Path "HKLM:\Software\Microsoft\Windows\CurrentVersion\Explorer\MyComputer\NameSpace\{d3162b92-9365-467a-956b-92703aca08af}"
  339. # New-Item -Path "HKLM:\Software\Microsoft\Windows\CurrentVersion\Explorer\MyComputer\NameSpace\{A8CDFF1C-4878-43be-B5FD-F8091C1C60D0}"
  340.  
  341. # Remove Downloads icon from computer namespace
  342. # Write-Host "Removing Downloads icon from computer namespace..."
  343. # Remove-Item -Path "HKLM:\Software\Microsoft\Windows\CurrentVersion\Explorer\MyComputer\NameSpace\{088e3905-0323-4b02-9826-5d99428e115f}" -Recurse -ErrorAction SilentlyContinue
  344. # Remove-Item -Path "HKLM:\Software\Microsoft\Windows\CurrentVersion\Explorer\MyComputer\NameSpace\{374DE290-123F-4565-9164-39C4925E467B}" -Recurse -ErrorAction SilentlyContinue
  345.  
  346. # Add Downloads icon to computer namespace
  347. # New-Item -Path "HKLM:\Software\Microsoft\Windows\CurrentVersion\Explorer\MyComputer\NameSpace\{088e3905-0323-4b02-9826-5d99428e115f}"
  348. # New-Item -Path "HKLM:\Software\Microsoft\Windows\CurrentVersion\Explorer\MyComputer\NameSpace\{374DE290-123F-4565-9164-39C4925E467B}"
  349.  
  350. # Remove Music icon from computer namespace
  351. # Write-Host "Removing Music icon from computer namespace..."
  352. # Remove-Item -Path "HKLM:\Software\Microsoft\Windows\CurrentVersion\Explorer\MyComputer\NameSpace\{3dfdf296-dbec-4fb4-81d1-6a3438bcf4de}" -Recurse -ErrorAction SilentlyContinue
  353. # Remove-Item -Path "HKLM:\Software\Microsoft\Windows\CurrentVersion\Explorer\MyComputer\NameSpace\{1CF1260C-4DD0-4ebb-811F-33C572699FDE}" -Recurse -ErrorAction SilentlyContinue
  354.  
  355. # Add Music icon to computer namespace
  356. # New-Item -Path "HKLM:\Software\Microsoft\Windows\CurrentVersion\Explorer\MyComputer\NameSpace\{3dfdf296-dbec-4fb4-81d1-6a3438bcf4de}"
  357. # New-Item -Path "HKLM:\Software\Microsoft\Windows\CurrentVersion\Explorer\MyComputer\NameSpace\{1CF1260C-4DD0-4ebb-811F-33C572699FDE}"
  358.  
  359. # Remove Pictures icon from computer namespace
  360. # Write-Host "Removing Pictures icon from computer namespace..."
  361. # Remove-Item -Path "HKLM:\Software\Microsoft\Windows\CurrentVersion\Explorer\MyComputer\NameSpace\{24ad3ad4-a569-4530-98e1-ab02f9417aa8}" -Recurse -ErrorAction SilentlyContinue
  362. # Remove-Item -Path "HKLM:\Software\Microsoft\Windows\CurrentVersion\Explorer\MyComputer\NameSpace\{3ADD1653-EB32-4cb0-BBD7-DFA0ABB5ACCA}" -Recurse -ErrorAction SilentlyContinue
  363.  
  364. # Add Pictures icon to computer namespace
  365. # New-Item -Path "HKLM:\Software\Microsoft\Windows\CurrentVersion\Explorer\MyComputer\NameSpace\{24ad3ad4-a569-4530-98e1-ab02f9417aa8}"
  366. # New-Item -Path "HKLM:\Software\Microsoft\Windows\CurrentVersion\Explorer\MyComputer\NameSpace\{3ADD1653-EB32-4cb0-BBD7-DFA0ABB5ACCA}"
  367.  
  368. # Remove Videos icon from computer namespace
  369. # Write-Host "Removing Videos icon from computer namespace..."
  370. # Remove-Item -Path "HKLM:\Software\Microsoft\Windows\CurrentVersion\Explorer\MyComputer\NameSpace\{f86fa3ab-70d2-4fc7-9c99-fcbf05467f3a}" -Recurse -ErrorAction SilentlyContinue
  371. # Remove-Item -Path "HKLM:\Software\Microsoft\Windows\CurrentVersion\Explorer\MyComputer\NameSpace\{A0953C92-50DC-43bf-BE83-3742FED03C9C}" -Recurse -ErrorAction SilentlyContinue
  372.  
  373. # Add Videos icon to computer namespace
  374. # New-Item -Path "HKLM:\Software\Microsoft\Windows\CurrentVersion\Explorer\MyComputer\NameSpace\{f86fa3ab-70d2-4fc7-9c99-fcbf05467f3a}"
  375. # New-Item -Path "HKLM:\Software\Microsoft\Windows\CurrentVersion\Explorer\MyComputer\NameSpace\{A0953C92-50DC-43bf-BE83-3742FED03C9C}"
  376.  
  377. ## Add secondary en-US keyboard
  378. #Write-Host "Adding secondary en-US keyboard..."
  379. #$langs = Get-WinUserLanguageList
  380. #$langs.Add("en-US")
  381. #Set-WinUserLanguageList $langs -Force
  382.  
  383. # Remove secondary en-US keyboard
  384. # $langs = Get-WinUserLanguageList
  385. # Set-WinUserLanguageList ($langs | ? {$_.LanguageTag -ne "en-US"}) -Force
  386.  
  387.  
  388.  
  389. ##########
  390. # Remove unwanted applications
  391. ##########
  392.  
  393. # Disable OneDrive
  394. Write-Host "Disabling OneDrive..."
  395. If (!(Test-Path "HKLM:\SOFTWARE\Policies\Microsoft\Windows\OneDrive")) {
  396.     New-Item -Path "HKLM:\SOFTWARE\Policies\Microsoft\Windows\OneDrive" | Out-Null
  397. }
  398. Set-ItemProperty -Path "HKLM:\SOFTWARE\Policies\Microsoft\Windows\OneDrive" -Name "DisableFileSyncNGSC" -Type DWord -Value 1
  399.  
  400. # Enable OneDrive
  401. # Remove-ItemProperty -Path "HKLM:\SOFTWARE\Policies\Microsoft\Windows\OneDrive" -Name "DisableFileSyncNGSC"
  402.  
  403. # Uninstall OneDrive (WINDOWS WILL NOT SYSPREP WITHOUT IT!)
  404. # Write-Host "Uninstalling OneDrive..."
  405. # Stop-Process -Name OneDrive -ErrorAction SilentlyContinue
  406. # Start-Sleep -s 3
  407. # $onedrive = "$env:SYSTEMROOT\SysWOW64\OneDriveSetup.exe"
  408. # If (!(Test-Path $onedrive)) {
  409. #   $onedrive = "$env:SYSTEMROOT\System32\OneDriveSetup.exe"
  410. # }
  411. # Start-Process $onedrive "/uninstall" -NoNewWindow -Wait
  412. # Start-Sleep -s 3
  413. # Stop-Process -Name explorer -ErrorAction SilentlyContinue
  414. # Start-Sleep -s 3
  415. # Remove-Item "$env:USERPROFILE\OneDrive" -Force -Recurse -ErrorAction SilentlyContinue
  416. # Remove-Item "$env:LOCALAPPDATA\Microsoft\OneDrive" -Force -Recurse -ErrorAction SilentlyContinue
  417. # Remove-Item "$env:PROGRAMDATA\Microsoft OneDrive" -Force -Recurse -ErrorAction SilentlyContinue
  418. # If (Test-Path "$env:SYSTEMDRIVE\OneDriveTemp") {
  419. #   Remove-Item "$env:SYSTEMDRIVE\OneDriveTemp" -Force -Recurse -ErrorAction SilentlyContinue
  420. # }
  421. # If (!(Test-Path "HKCR:")) {
  422. #   New-PSDrive -Name HKCR -PSProvider Registry -Root HKEY_CLASSES_ROOT | Out-Null
  423. # }
  424. # Remove-Item -Path "HKCR:\CLSID\{018D5C66-4533-4307-9B53-224DE2ED1FE6}" -Recurse -ErrorAction SilentlyContinue
  425. # Remove-Item -Path "HKCR:\Wow6432Node\CLSID\{018D5C66-4533-4307-9B53-224DE2ED1FE6}" -Recurse -ErrorAction SilentlyContinue
  426.  
  427. # Install OneDrive
  428. # $onedrive = "$env:SYSTEMROOT\SysWOW64\OneDriveSetup.exe"
  429. # If (!(Test-Path $onedrive)) {
  430. #   $onedrive = "$env:SYSTEMROOT\System32\OneDriveSetup.exe"
  431. # }
  432. # Start-Process $onedrive -NoNewWindow
  433.  
  434. # Uninstall default Microsoft applications
  435. Write-Host "Uninstalling default Microsoft applications..."
  436. Get-AppxPackage "Microsoft.3DBuilder" | Remove-AppxPackage
  437. Get-AppxPackage "Microsoft.BingFinance" | Remove-AppxPackage
  438. Get-AppxPackage "Microsoft.BingNews" | Remove-AppxPackage
  439. Get-AppxPackage "Microsoft.BingSports" | Remove-AppxPackage
  440. Get-AppxPackage "Microsoft.BingWeather" | Remove-AppxPackage
  441. Get-AppxPackage "Microsoft.Getstarted" | Remove-AppxPackage
  442. Get-AppxPackage "Microsoft.MicrosoftOfficeHub" | Remove-AppxPackage
  443. Get-AppxPackage "Microsoft.MicrosoftSolitaireCollection" | Remove-AppxPackage
  444. Get-AppxPackage "Microsoft.Office.OneNote" | Remove-AppxPackage
  445. Get-AppxPackage "Microsoft.People" | Remove-AppxPackage
  446. Get-AppxPackage "Microsoft.SkypeApp" | Remove-AppxPackage
  447. Get-AppxPackage "Microsoft.Windows.Photos" | Remove-AppxPackage
  448. # Get-AppxPackage "Microsoft.WindowsAlarms" | Remove-AppxPackage
  449. # Get-AppxPackage "Microsoft.WindowsCamera" | Remove-AppxPackage
  450. Get-AppxPackage "microsoft.windowscommunicationsapps" | Remove-AppxPackage
  451. Get-AppxPackage "Microsoft.WindowsMaps" | Remove-AppxPackage
  452. Get-AppxPackage "Microsoft.WindowsPhone" | Remove-AppxPackage
  453. Get-AppxPackage "Microsoft.WindowsSoundRecorder" | Remove-AppxPackage
  454. Get-AppxPackage "Microsoft.XboxApp" | Remove-AppxPackage
  455. Get-AppxPackage "Microsoft.ZuneMusic" | Remove-AppxPackage
  456. Get-AppxPackage "Microsoft.ZuneVideo" | Remove-AppxPackage
  457. Get-AppxPackage "Microsoft.AppConnector" | Remove-AppxPackage
  458. Get-AppxPackage "Microsoft.ConnectivityStore" | Remove-AppxPackage
  459. Get-AppxPackage "Microsoft.Office.Sway" | Remove-AppxPackage
  460. Get-AppxPackage "Microsoft.Messaging" | Remove-AppxPackage
  461. Get-AppxPackage "Microsoft.CommsPhone" | Remove-AppxPackage
  462. Get-AppxPackage "9E2F88E3.Twitter" | Remove-AppxPackage
  463. Get-AppxPackage "king.com.CandyCrushSodaSaga" | Remove-AppxPackage
  464. Get-AppxPackage "Microsoft.WindowsFeedbackHub" | Remove-AppxPackage
  465. Get-AppxPackage "Microsoft.Wallet" | Remove-AppxPackage
  466. Get-AppxPackage "Microsoft.ScreenSketch" | Remove-AppxPackage
  467. Get-AppxPackage "Microsoft.GetHelp" | Remove-AppxPackage
  468. Get-AppxPackage "Microsoft.Xbox.TCUI" | Remove-AppxPackage
  469. Get-AppxPackage "Microsoft.XboxGameOverlay" | Remove-AppxPackage
  470. Get-AppxPackage "Microsoft.XboxSpeechToTextOverlay" | Remove-AppxPackage
  471. Get-AppxPackage "Microsoft.MixedReality.Portal" | Remove-AppxPackage
  472. Get-AppBackgroundTask "Microsoft.XboxIdentityProvider" | Remove-AppPackage
  473.  
  474.  
  475. # Install default Microsoft applications
  476. # Add-AppxPackage -DisableDevelopmentMode -Register "$($(Get-AppXPackage -AllUsers "Microsoft.3DBuilder").InstallLocation)\AppXManifest.xml"
  477. # Add-AppxPackage -DisableDevelopmentMode -Register "$($(Get-AppXPackage -AllUsers "Microsoft.BingFinance").InstallLocation)\AppXManifest.xml"
  478. # Add-AppxPackage -DisableDevelopmentMode -Register "$($(Get-AppXPackage -AllUsers "Microsoft.BingNews").InstallLocation)\AppXManifest.xml"
  479. # Add-AppxPackage -DisableDevelopmentMode -Register "$($(Get-AppXPackage -AllUsers "Microsoft.BingSports").InstallLocation)\AppXManifest.xml"
  480. # Add-AppxPackage -DisableDevelopmentMode -Register "$($(Get-AppXPackage -AllUsers "Microsoft.BingWeather").InstallLocation)\AppXManifest.xml"
  481. # Add-AppxPackage -DisableDevelopmentMode -Register "$($(Get-AppXPackage -AllUsers "Microsoft.Getstarted").InstallLocation)\AppXManifest.xml"
  482. # Add-AppxPackage -DisableDevelopmentMode -Register "$($(Get-AppXPackage -AllUsers "Microsoft.MicrosoftOfficeHub").InstallLocation)\AppXManifest.xml"
  483. # Add-AppxPackage -DisableDevelopmentMode -Register "$($(Get-AppXPackage -AllUsers "Microsoft.MicrosoftSolitaireCollection").InstallLocation)\AppXManifest.xml"
  484. # Add-AppxPackage -DisableDevelopmentMode -Register "$($(Get-AppXPackage -AllUsers "Microsoft.Office.OneNote").InstallLocation)\AppXManifest.xml"
  485. # Add-AppxPackage -DisableDevelopmentMode -Register "$($(Get-AppXPackage -AllUsers "Microsoft.People").InstallLocation)\AppXManifest.xml"
  486. # Add-AppxPackage -DisableDevelopmentMode -Register "$($(Get-AppXPackage -AllUsers "Microsoft.SkypeApp").InstallLocation)\AppXManifest.xml"
  487. # Add-AppxPackage -DisableDevelopmentMode -Register "$($(Get-AppXPackage -AllUsers "Microsoft.Windows.Photos").InstallLocation)\AppXManifest.xml"
  488. # Add-AppxPackage -DisableDevelopmentMode -Register "$($(Get-AppXPackage -AllUsers "Microsoft.WindowsAlarms").InstallLocation)\AppXManifest.xml"
  489. # Add-AppxPackage -DisableDevelopmentMode -Register "$($(Get-AppXPackage -AllUsers "Microsoft.WindowsCamera").InstallLocation)\AppXManifest.xml"
  490. # Add-AppxPackage -DisableDevelopmentMode -Register "$($(Get-AppXPackage -AllUsers "Microsoft.windowscommunicationsapps").InstallLocation)\AppXManifest.xml"
  491. # Add-AppxPackage -DisableDevelopmentMode -Register "$($(Get-AppXPackage -AllUsers "Microsoft.WindowsMaps").InstallLocation)\AppXManifest.xml"
  492. # Add-AppxPackage -DisableDevelopmentMode -Register "$($(Get-AppXPackage -AllUsers "Microsoft.WindowsPhone").InstallLocation)\AppXManifest.xml"
  493. # Add-AppxPackage -DisableDevelopmentMode -Register "$($(Get-AppXPackage -AllUsers "Microsoft.WindowsSoundRecorder").InstallLocation)\AppXManifest.xml"
  494. # Add-AppxPackage -DisableDevelopmentMode -Register "$($(Get-AppXPackage -AllUsers "Microsoft.XboxApp").InstallLocation)\AppXManifest.xml"
  495. # Add-AppxPackage -DisableDevelopmentMode -Register "$($(Get-AppXPackage -AllUsers "Microsoft.ZuneMusic").InstallLocation)\AppXManifest.xml"
  496. # Add-AppxPackage -DisableDevelopmentMode -Register "$($(Get-AppXPackage -AllUsers "Microsoft.ZuneVideo").InstallLocation)\AppXManifest.xml"
  497. # Add-AppxPackage -DisableDevelopmentMode -Register "$($(Get-AppXPackage -AllUsers "Microsoft.AppConnector").InstallLocation)\AppXManifest.xml"
  498. # Add-AppxPackage -DisableDevelopmentMode -Register "$($(Get-AppXPackage -AllUsers "Microsoft.ConnectivityStore").InstallLocation)\AppXManifest.xml"
  499. # Add-AppxPackage -DisableDevelopmentMode -Register "$($(Get-AppXPackage -AllUsers "Microsoft.Office.Sway").InstallLocation)\AppXManifest.xml"
  500. # Add-AppxPackage -DisableDevelopmentMode -Register "$($(Get-AppXPackage -AllUsers "Microsoft.Messaging").InstallLocation)\AppXManifest.xml"
  501. # Add-AppxPackage -DisableDevelopmentMode -Register "$($(Get-AppXPackage -AllUsers "Microsoft.CommsPhone").InstallLocation)\AppXManifest.xml"
  502. # In case you have removed them for good, you can try to restore the files using installation medium as follows
  503. # New-Item C:\Mnt -Type Directory | Out-Null
  504. # dism /Mount-Image /ImageFile:D:\sources\install.wim /index:1 /ReadOnly /MountDir:C:\Mnt
  505. # robocopy /S /SEC /R:0 "C:\Mnt\Program Files\WindowsApps" "C:\Program Files\WindowsApps"
  506. # dism /Unmount-Image /Discard /MountDir:C:\Mnt
  507. # Remove-Item -Path C:\Mnt -Recurse
  508.  
  509. # Uninstall Windows Media Player
  510.  Write-Host "Uninstalling Windows Media Player..."
  511. ork folder dism /online /Disable-Feature /FeatureName:MediaPlayback /Quiet /NoRestart
  512.  
  513. # Install Windows Media Player
  514. # dism /online /Enable-Feature /FeatureName:MediaPlayback /Quiet /NoRestart
  515.  
  516. # Uninstall Work Folders Client
  517. Write-Host "Uninstalling Work Folders Client..."
  518. dism /online /Disable-Feature /FeatureName:WorkFolders-Client /Quiet /NoRestart
  519.  
  520. # Install Work Folders Client
  521. # dism /online /Enable-Feature /FeatureName:WorkFolders-Client /Quiet /NoRestart
  522.  
  523. # Set Photo Viewer as default for bmp, gif, jpg and png
  524. # Write-Host "Setting Photo Viewer as default for bmp, gif, jpg, png and tif..."
  525. # If (!(Test-Path "HKCR:")) {
  526. #   New-PSDrive -Name HKCR -PSProvider Registry -Root HKEY_CLASSES_ROOT | Out-Null
  527. # }
  528. # ForEach ($type in @("Paint.Picture", "giffile", "jpegfile", "pngfile")) {
  529. #   New-Item -Path $("HKCR:\$type\shell\open") -Force | Out-Null
  530. #   New-Item -Path $("HKCR:\$type\shell\open\command") | Out-Null
  531. #   Set-ItemProperty -Path $("HKCR:\$type\shell\open") -Name "MuiVerb" -Type ExpandString -Value "@%ProgramFiles%\Windows Photo Viewer\photoviewer.dll,-3043"
  532. #   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"
  533. # }
  534.  
  535. # Remove or reset default open action for bmp, gif, jpg and png
  536. # If (!(Test-Path "HKCR:")) {
  537. #   New-PSDrive -Name HKCR -PSProvider Registry -Root HKEY_CLASSES_ROOT | Out-Null
  538. # }
  539. # Remove-Item -Path "HKCR:\Paint.Picture\shell\open" -Recurse
  540. # Remove-ItemProperty -Path "HKCR:\giffile\shell\open" -Name "MuiVerb"
  541. # Set-ItemProperty -Path "HKCR:\giffile\shell\open" -Name "CommandId" -Type String -Value "IE.File"
  542. # Set-ItemProperty -Path "HKCR:\giffile\shell\open\command" -Name "(Default)" -Type String -Value "`"$env:SystemDrive\Program Files\Internet Explorer\iexplore.exe`" %1"
  543. # Set-ItemProperty -Path "HKCR:\giffile\shell\open\command" -Name "DelegateExecute" -Type String -Value "{17FE9752-0B5A-4665-84CD-569794602F5C}"
  544. # Remove-Item -Path "HKCR:\jpegfile\shell\open" -Recurse
  545. # Remove-Item -Path "HKCR:\pngfile\shell\open" -Recurse
  546.  
  547. # Show Photo Viewer in "Open with..."
  548. Write-Host "Showing Photo Viewer in `"Open with...`""
  549. If (!(Test-Path "HKCR:")) {
  550.     New-PSDrive -Name HKCR -PSProvider Registry -Root HKEY_CLASSES_ROOT | Out-Null
  551. }
  552. New-Item -Path "HKCR:\Applications\photoviewer.dll\shell\open\command" -Force | Out-Null
  553. New-Item -Path "HKCR:\Applications\photoviewer.dll\shell\open\DropTarget" -Force | Out-Null
  554. Set-ItemProperty -Path "HKCR:\Applications\photoviewer.dll\shell\open" -Name "MuiVerb" -Type String -Value "@photoviewer.dll,-3043"
  555. 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"
  556. Set-ItemProperty -Path "HKCR:\Applications\photoviewer.dll\shell\open\DropTarget" -Name "Clsid" -Type String -Value "{FFE2A43C-56B9-4bf5-9A79-CC6D4285608A}"
  557.  
  558. # Remove Photo Viewer from "Open with..."
  559. # If (!(Test-Path "HKCR:")) {
  560. #   New-PSDrive -Name HKCR -PSProvider Registry -Root HKEY_CLASSES_ROOT | Out-Null
  561. # }
  562. # Remove-Item -Path "HKCR:\Applications\photoviewer.dll\shell\open" -Recurse
  563.  
  564. # This script disables unwanted Windows services. If you do not want to disable
  565. # certain services comment out the corresponding lines below.
  566.  
  567. $services = @(
  568.     "diagnosticshub.standardcollector.service" # Microsoft (R) Diagnostics Hub Standard Collector Service
  569.     "DiagTrack"                                # Diagnostics Tracking Service
  570.     "dmwappushservice"                         # WAP Push Message Routing Service (see known issues)
  571.     "lfsvc"                                    # Geolocation Service
  572.     "MapsBroker"                               # Downloaded Maps Manager
  573.     "NetTcpPortSharing"                        # Net.Tcp Port Sharing Service
  574.     "RemoteAccess"                             # Routing and Remote Access
  575.     # "RemoteRegistry"                         # Remote Registry
  576.     "SharedAccess"                             # Internet Connection Sharing (ICS)
  577.     "TrkWks"                                   # Distributed Link Tracking Client
  578.     # "WbioSrvc"                               # Windows Biometric Service (required for Fingerprint reader / facial detection)
  579.     #"WlanSvc"                                 # WLAN AutoConfig
  580.     "WMPNetworkSvc"                            # Windows Media Player Network Sharing Service
  581.     #"wscsvc"                                  # Windows Security Center Service
  582.     #"WSearch"                                 # Windows Search
  583.     "XblAuthManager"                           # Xbox Live Auth Manager
  584.     "XblGameSave"                              # Xbox Live Game Save Service
  585.     "XboxNetApiSvc"                            # Xbox Live Networking Service
  586.     "ndu"                                      # Windows Network Data Usage Monitor
  587.     # Services which cannot be disabled
  588.     #"WdNisSvc"
  589. )
  590.  
  591. foreach ($service in $services) {
  592.     Write-Output "Trying to disable $service"
  593.     Get-Service -Name $service | Set-Service -StartupType Disabled
  594. }
  595.  
  596.  
  597. #   Description:
  598. # This script optimizes Windows updates by disabling automatic download and
  599. # seeding updates to other computers.
  600. #
  601. Import-Module -DisableNameChecking $PSScriptRoot\..\lib\New-FolderForced.psm1
  602.  
  603. Write-Output "Disable automatic download and installation of Windows updates"
  604. New-FolderForced -Path "HKLM:\SOFTWARE\Wow6432Node\Policies\Microsoft\Windows\WindowsUpdate\AU"
  605. Set-ItemProperty -Path "HKLM:\SOFTWARE\Wow6432Node\Policies\Microsoft\Windows\WindowsUpdate\AU" "NoAutoUpdate" 0
  606. Set-ItemProperty -Path "HKLM:\SOFTWARE\Wow6432Node\Policies\Microsoft\Windows\WindowsUpdate\AU" "AUOptions" 2
  607. Set-ItemProperty -Path "HKLM:\SOFTWARE\Wow6432Node\Policies\Microsoft\Windows\WindowsUpdate\AU" "ScheduledInstallDay" 0
  608. Set-ItemProperty -Path "HKLM:\SOFTWARE\Wow6432Node\Policies\Microsoft\Windows\WindowsUpdate\AU" "ScheduledInstallTime" 3
  609.  
  610. Write-Output "Disable seeding of updates to other computers via Group Policies"
  611. New-FolderForced -Path "HKLM:\SOFTWARE\Policies\Microsoft\Windows\DeliveryOptimization"
  612. Set-ItemProperty -Path "HKLM:\SOFTWARE\Policies\Microsoft\Windows\DeliveryOptimization" "DODownloadMode" 0
  613.  
  614. #echo "Disabling automatic driver update"
  615. #sp "HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\DriverSearching" "SearchOrderConfig" 0
  616.  
  617. $objSID = New-Object System.Security.Principal.SecurityIdentifier "S-1-1-0"
  618. $EveryOne = $objSID.Translate( [System.Security.Principal.NTAccount]).Value
  619.  
  620.  
  621. Write-Output "Disable 'Updates are available' message"
  622.  
  623. takeown /F "$env:WinDIR\System32\MusNotification.exe"
  624. icacls "$env:WinDIR\System32\MusNotification.exe" /deny "$($EveryOne):(X)"
  625. takeown /F "$env:WinDIR\System32\MusNotificationUx.exe"
  626. icacls "$env:WinDIR\System32\MusNotificationUx.exe" /deny "$($EveryOne):(X)"
  627.  
  628.  
  629. # This script removes unwanted Apps that come with Windows. If you  do not want
  630. # to remove certain Apps comment out the corresponding lines below.
  631.  
  632. Import-Module -DisableNameChecking $PSScriptRoot\..\lib\take-own.psm1
  633. Import-Module -DisableNameChecking $PSScriptRoot\..\lib\New-FolderForced.psm1
  634.  
  635. Write-Output "Elevating privileges for this process"
  636. do {} until (Elevate-Privileges SeTakeOwnershipPrivilege)
  637.  
  638. Write-Output "Uninstalling default apps"
  639. $apps = @(
  640.     # default Windows 10 apps
  641.     "Microsoft.3DBuilder"
  642.     "Microsoft.Advertising.Xaml"
  643.     "Microsoft.Appconnector"
  644.     "Microsoft.BingFinance"
  645.     "Microsoft.BingNews"
  646.     "Microsoft.BingSports"
  647.     "Microsoft.BingTranslator"
  648.     "Microsoft.BingWeather"
  649.     "Microsoft.FreshPaint"
  650.     "Microsoft.GamingServices"
  651.     "Microsoft.Microsoft3DViewer"
  652.     "Microsoft.WindowsFeedbackHub"
  653.     "Microsoft.MicrosoftOfficeHub"
  654.     "Microsoft.MixedReality.Portal"
  655.     "Microsoft.MicrosoftPowerBIForWindows"
  656.     "Microsoft.MicrosoftSolitaireCollection"
  657.     "Microsoft.MicrosoftStickyNotes"
  658.     "Microsoft.MinecraftUWP"
  659.     "Microsoft.NetworkSpeedTest"
  660.     "Microsoft.Office.OneNote"
  661.     "Microsoft.People"
  662.     "Microsoft.Print3D"
  663.     "Microsoft.SkypeApp"
  664.     "Microsoft.Wallet"
  665.     # "Microsoft.Windows.Photos"
  666.     # "Microsoft.WindowsAlarms"
  667.     # "Microsoft.WindowsCalculator"
  668.     # "Microsoft.WindowsCamera"
  669.     "microsoft.windowscommunicationsapps"
  670.     "Microsoft.WindowsMaps"
  671.     "Microsoft.WindowsPhone"
  672.     "Microsoft.WindowsSoundRecorder"
  673.     #"Microsoft.WindowsStore"   # can't be re-installed
  674.     "Microsoft.Xbox.TCUI"
  675.     "Microsoft.XboxApp"
  676.     "Microsoft.XboxGameOverlay"
  677.     "Microsoft.XboxGamingOverlay"
  678.     "Microsoft.XboxSpeechToTextOverlay"
  679.     "Microsoft.YourPhone"
  680.     "Microsoft.ZuneMusic"
  681.     "Microsoft.ZuneVideo"
  682.     "Microsoft.Windows.CloudExperienceHost"
  683.     "Microsoft.Windows.ContentDeliveryManager"
  684.     "Microsoft.Windows.PeopleExperienceHost"
  685.     "Microsoft.XboxGameCallableUI"
  686.  
  687.     # Threshold 2 apps
  688.     "Microsoft.CommsPhone"
  689.     "Microsoft.ConnectivityStore"
  690.     "Microsoft.GetHelp"
  691.     "Microsoft.Getstarted"
  692.     "Microsoft.Messaging"
  693.     "Microsoft.Office.Sway"
  694.     "Microsoft.OneConnect"
  695.     "Microsoft.WindowsFeedbackHub"
  696.  
  697.     # Creators Update apps
  698.     "Microsoft.Microsoft3DViewer"
  699.     #"Microsoft.MSPaint"
  700.  
  701.     #Redstone apps
  702.     "Microsoft.BingFoodAndDrink"
  703.     "Microsoft.BingHealthAndFitness"
  704.     "Microsoft.BingTravel"
  705.     "Microsoft.WindowsReadingList"
  706.  
  707.     # Redstone 5 apps
  708.     "Microsoft.MixedReality.Portal"
  709.     "Microsoft.ScreenSketch"
  710.     "Microsoft.XboxGamingOverlay"
  711.     "Microsoft.YourPhone"
  712.  
  713.     # non-Microsoft
  714.     "2FE3CB00.PicsArt-PhotoStudio"
  715.     "46928bounde.EclipseManager"
  716.     "4DF9E0F8.Netflix"
  717.     "613EBCEA.PolarrPhotoEditorAcademicEdition"
  718.     "6Wunderkinder.Wunderlist"
  719.     "7EE7776C.LinkedInforWindows"
  720.     "89006A2E.AutodeskSketchBook"
  721.     "9E2F88E3.Twitter"
  722.     "A278AB0D.DisneyMagicKingdoms"
  723.     "A278AB0D.MarchofEmpires"
  724.     "ActiproSoftwareLLC.562882FEEB491" # next one is for the Code Writer from Actipro Software LLC
  725.     "CAF9E577.Plex"  
  726.     "ClearChannelRadioDigital.iHeartRadio"
  727.     "D52A8D61.FarmVille2CountryEscape"
  728.     "D5EA27B7.Duolingo-LearnLanguagesforFree"
  729.     "DB6EA5DB.CyberLinkMediaSuiteEssentials"
  730.     "DolbyLaboratories.DolbyAccess"
  731.     "DolbyLaboratories.DolbyAccess"
  732.     "Drawboard.DrawboardPDF"
  733.     "Facebook.Facebook"
  734.     "Fitbit.FitbitCoach"
  735.     "Flipboard.Flipboard"
  736.     "GAMELOFTSA.Asphalt8Airborne"
  737.     "KeeperSecurityInc.Keeper"
  738.     "NORDCURRENT.COOKINGFEVER"
  739.     "PandoraMediaInc.29680B314EFC2"
  740.     "Playtika.CaesarsSlotsFreeCasino"
  741.     "ShazamEntertainmentLtd.Shazam"
  742.     "SlingTVLLC.SlingTV"
  743.     "SpotifyAB.SpotifyMusic"
  744.     "TheNewYorkTimes.NYTCrossword"
  745.     "ThumbmunkeysLtd.PhototasticCollage"
  746.     "TuneIn.TuneInRadio"
  747.     "WinZipComputing.WinZipUniversal"
  748.     "XINGAG.XING"
  749.     "flaregamesGmbH.RoyalRevolt2"
  750.     "king.com.*"
  751.     "king.com.BubbleWitch3Saga"
  752.     "king.com.CandyCrushSaga"
  753.     "king.com.CandyCrushSodaSaga"
  754.  
  755.     # apps which cannot be removed using Remove-AppxPackage
  756.     "Microsoft.BioEnrollment"
  757.     #"Microsoft.MicrosoftEdge"
  758.     "Microsoft.Windows.Cortana"
  759.     "Microsoft.WindowsFeedback"
  760.     "Microsoft.XboxGameCallableUI"
  761.     "Microsoft.XboxIdentityProvider"
  762.     "Windows.ContactSupport"
  763.  
  764.     # apps which other apps depend on
  765.     "Microsoft.Advertising.Xaml"
  766. )
  767.  
  768. foreach ($app in $apps) {
  769.     Write-Output "Trying to remove $app"
  770.  
  771.     Get-AppxPackage -Name $app -AllUsers | Remove-AppxPackage -AllUsers
  772.  
  773.     Get-AppXProvisionedPackage -Online |
  774.         Where-Object DisplayName -EQ $app |
  775.         Remove-AppxProvisionedPackage -Online
  776. }
  777.  
  778. # Prevents Apps from re-installing
  779. $cdm = @(
  780.     "ContentDeliveryAllowed"
  781.     "FeatureManagementEnabled"
  782.     "OemPreInstalledAppsEnabled"
  783.     "PreInstalledAppsEnabled"
  784.     "PreInstalledAppsEverEnabled"
  785.     "SilentInstalledAppsEnabled"
  786.     "SubscribedContent-314559Enabled"
  787.     "SubscribedContent-338387Enabled"
  788.     "SubscribedContent-338388Enabled"
  789.     "SubscribedContent-338389Enabled"
  790.     "SubscribedContent-338393Enabled"
  791.     "SubscribedContentEnabled"
  792.     "SystemPaneSuggestionsEnabled"
  793. )
  794.  
  795. New-FolderForced -Path "HKCU:\Software\Microsoft\Windows\CurrentVersion\ContentDeliveryManager"
  796. foreach ($key in $cdm) {
  797.     Set-ItemProperty -Path "HKCU:\Software\Microsoft\Windows\CurrentVersion\ContentDeliveryManager" $key 0
  798. }
  799.  
  800. New-FolderForced -Path "HKLM:\SOFTWARE\Policies\Microsoft\WindowsStore"
  801. Set-ItemProperty -Path "HKLM:\SOFTWARE\Policies\Microsoft\WindowsStore" "AutoDownload" 2
  802.  
  803. # Prevents "Suggested Applications" returning
  804. New-FolderForced -Path "HKLM:\SOFTWARE\Policies\Microsoft\Windows\CloudContent"
  805. Set-ItemProperty -Path "HKLM:\SOFTWARE\Policies\Microsoft\Windows\CloudContent" "DisableWindowsConsumerFeatures" 1
  806.  
  807. #   Description:
  808. # This script will remove and disable OneDrive integration.
  809.  
  810. Import-Module -DisableNameChecking $PSScriptRoot\..\lib\New-FolderForced.psm1
  811. Import-Module -DisableNameChecking $PSScriptRoot\..\lib\take-own.psm1
  812.  
  813. Write-Output "Kill OneDrive process"
  814. taskkill.exe /F /IM "OneDrive.exe"
  815. taskkill.exe /F /IM "explorer.exe"
  816.  
  817. Write-Output "Remove OneDrive"
  818. if (Test-Path "$env:systemroot\System32\OneDriveSetup.exe") {
  819.     & "$env:systemroot\System32\OneDriveSetup.exe" /uninstall
  820. }
  821. if (Test-Path "$env:systemroot\SysWOW64\OneDriveSetup.exe") {
  822.     & "$env:systemroot\SysWOW64\OneDriveSetup.exe" /uninstall
  823. }
  824.  
  825. Write-Output "Removing OneDrive leftovers"
  826. Remove-Item -Recurse -Force -ErrorAction SilentlyContinue "$env:localappdata\Microsoft\OneDrive"
  827. Remove-Item -Recurse -Force -ErrorAction SilentlyContinue "$env:programdata\Microsoft OneDrive"
  828. Remove-Item -Recurse -Force -ErrorAction SilentlyContinue "$env:systemdrive\OneDriveTemp"
  829. # check if directory is empty before removing:
  830. If ((Get-ChildItem "$env:userprofile\OneDrive" -Recurse | Measure-Object).Count -eq 0) {
  831.     Remove-Item -Recurse -Force -ErrorAction SilentlyContinue "$env:userprofile\OneDrive"
  832. }
  833.  
  834. Write-Output "Disable OneDrive via Group Policies"
  835. New-FolderForced -Path "HKLM:\SOFTWARE\Wow6432Node\Policies\Microsoft\Windows\OneDrive"
  836. Set-ItemProperty -Path "HKLM:\SOFTWARE\Wow6432Node\Policies\Microsoft\Windows\OneDrive" "DisableFileSyncNGSC" 1
  837.  
  838. Write-Output "Remove Onedrive from explorer sidebar"
  839. New-PSDrive -PSProvider "Registry" -Root "HKEY_CLASSES_ROOT" -Name "HKCR"
  840. mkdir -Force "HKCR:\CLSID\{018D5C66-4533-4307-9B53-224DE2ED1FE6}"
  841. Set-ItemProperty -Path "HKCR:\CLSID\{018D5C66-4533-4307-9B53-224DE2ED1FE6}" "System.IsPinnedToNameSpaceTree" 0
  842. mkdir -Force "HKCR:\Wow6432Node\CLSID\{018D5C66-4533-4307-9B53-224DE2ED1FE6}"
  843. Set-ItemProperty -Path "HKCR:\Wow6432Node\CLSID\{018D5C66-4533-4307-9B53-224DE2ED1FE6}" "System.IsPinnedToNameSpaceTree" 0
  844. Remove-PSDrive "HKCR"
  845.  
  846. # Thank you Matthew Israelsson
  847. Write-Output "Removing run hook for new users"
  848. reg load "hku\Default" "C:\Users\Default\NTUSER.DAT"
  849. reg delete "HKEY_USERS\Default\SOFTWARE\Microsoft\Windows\CurrentVersion\Run" /v "OneDriveSetup" /f
  850. reg unload "hku\Default"
  851.  
  852. Write-Output "Removing startmenu entry"
  853. Remove-Item -Force -ErrorAction SilentlyContinue "$env:userprofile\AppData\Roaming\Microsoft\Windows\Start Menu\Programs\OneDrive.lnk"
  854.  
  855. Write-Output "Removing scheduled task"
  856. Get-ScheduledTask -TaskPath '\' -TaskName 'OneDrive*' -ea SilentlyContinue | Unregister-ScheduledTask -Confirm:$false
  857.  
  858. Write-Output "Restarting explorer"
  859. Start-Process "explorer.exe"
  860.  
  861. Write-Output "Waiting for explorer to complete loading"
  862. Start-Sleep 10
  863.  
  864. Write-Output "Removing additional OneDrive leftovers"
  865. foreach ($item in (Get-ChildItem "$env:WinDir\WinSxS\*onedrive*")) {
  866.     Takeown-Folder $item.FullName
  867.     Remove-Item -Recurse -Force $item.FullName
  868. }
  869.  
  870.  
  871.  
  872. # Remove Password Age Limit (Passwords never expire) #
  873.  
  874. net accounts /maxpwage:0
  875.  
  876.  
  877. # Set Password Age Limit to 60 Days#
  878.  
  879. #net accounts /maxpwage:60
  880.  
  881.  
  882. # This script removes all Start Menu Tiles from the .default user #
  883.  
  884. Set-Content -Path 'C:\Users\Default\AppData\Local\Microsoft\Windows\Shell\DefaultLayouts.xml' -Value '<LayoutModificationTemplate xmlns:defaultlayout="http://schemas.microsoft.com/Start/2014/FullDefaultLayout" xmlns:start="http://schemas.microsoft.com/Start/2014/StartLayout" Version="1" xmlns="http://schemas.microsoft.com/Start/2014/LayoutModification">'
  885. Add-Content -Path 'C:\Users\Default\AppData\Local\Microsoft\Windows\Shell\DefaultLayouts.xml' -value '  <LayoutOptions StartTileGroupCellWidth="6" />'
  886. Add-Content -Path 'C:\Users\Default\AppData\Local\Microsoft\Windows\Shell\DefaultLayouts.xml' -value '  <DefaultLayoutOverride>'
  887. Add-Content -Path 'C:\Users\Default\AppData\Local\Microsoft\Windows\Shell\DefaultLayouts.xml' -value '    <StartLayoutCollection>'
  888. Add-Content -Path 'C:\Users\Default\AppData\Local\Microsoft\Windows\Shell\DefaultLayouts.xml' -value '      <defaultlayout:StartLayout GroupCellWidth="6" />'
  889. Add-Content -Path 'C:\Users\Default\AppData\Local\Microsoft\Windows\Shell\DefaultLayouts.xml' -value '    </StartLayoutCollection>'
  890. Add-Content -Path 'C:\Users\Default\AppData\Local\Microsoft\Windows\Shell\DefaultLayouts.xml' -value '  </DefaultLayoutOverride>'
  891. Add-Content -Path 'C:\Users\Default\AppData\Local\Microsoft\Windows\Shell\DefaultLayouts.xml' -value '    <CustomTaskbarLayoutCollection>'
  892. Add-Content -Path 'C:\Users\Default\AppData\Local\Microsoft\Windows\Shell\DefaultLayouts.xml' -value '      <defaultlayout:TaskbarLayout>'
  893. Add-Content -Path 'C:\Users\Default\AppData\Local\Microsoft\Windows\Shell\DefaultLayouts.xml' -value '        <taskbar:TaskbarPinList>'
  894. Add-Content -Path 'C:\Users\Default\AppData\Local\Microsoft\Windows\Shell\DefaultLayouts.xml' -value '          <taskbar:UWA AppUserModelID="Microsoft.MicrosoftEdge_8wekyb3d8bbwe!MicrosoftEdge" />'
  895. Add-Content -Path 'C:\Users\Default\AppData\Local\Microsoft\Windows\Shell\DefaultLayouts.xml' -value '          <taskbar:DesktopApp DesktopApplicationLinkPath="%APPDATA%\Microsoft\Windows\Start Menu\Programs\System Tools\File Explorer.lnk" />'
  896. Add-Content -Path 'C:\Users\Default\AppData\Local\Microsoft\Windows\Shell\DefaultLayouts.xml' -value '        </taskbar:TaskbarPinList>'
  897. Add-Content -Path 'C:\Users\Default\AppData\Local\Microsoft\Windows\Shell\DefaultLayouts.xml' -value '      </defaultlayout:TaskbarLayout>'
  898. Add-Content -Path 'C:\Users\Default\AppData\Local\Microsoft\Windows\Shell\DefaultLayouts.xml' -value '    </CustomTaskbarLayoutCollection>'
  899. Add-Content -Path 'C:\Users\Default\AppData\Local\Microsoft\Windows\Shell\DefaultLayouts.xml' -value '</LayoutModificationTemplate>'
  900.  
  901. $START_MENU_LAYOUT = @"
  902. <LayoutModificationTemplate xmlns:defaultlayout="http://schemas.microsoft.com/Start/2014/FullDefaultLayout" xmlns:start="http://schemas.microsoft.com/Start/2014/StartLayout" Version="1" xmlns:taskbar="http://schemas.microsoft.com/Start/2014/TaskbarLayout" xmlns="http://schemas.microsoft.com/Start/2014/LayoutModification">
  903.    <LayoutOptions StartTileGroupCellWidth="6" />
  904.    <DefaultLayoutOverride>
  905.        <StartLayoutCollection>
  906.            <defaultlayout:StartLayout GroupCellWidth="6" />
  907.        </StartLayoutCollection>
  908.    </DefaultLayoutOverride>
  909. </LayoutModificationTemplate>
  910. "@
  911.  
  912. $layoutFile="C:\Windows\StartMenuLayout.xml"
  913.  
  914. #Delete layout file if it already exists
  915. If(Test-Path $layoutFile)
  916. {
  917.     Remove-Item $layoutFile
  918. }
  919.  
  920. #Creates the blank layout file
  921. $START_MENU_LAYOUT | Out-File $layoutFile -Encoding ASCII
  922.  
  923. $regAliases = @("HKLM", "HKCU")
  924.  
  925. #Assign the start layout and force it to apply with "LockedStartLayout" at both the machine and user level
  926. foreach ($regAlias in $regAliases){
  927.     $basePath = $regAlias + ":\SOFTWARE\Policies\Microsoft\Windows"
  928.     $keyPath = $basePath + "\Explorer"
  929.     IF(!(Test-Path -Path $keyPath)) {
  930.         New-Item -Path $basePath -Name "Explorer"
  931.     }
  932.     Set-ItemProperty -Path $keyPath -Name "LockedStartLayout" -Value 1
  933.     Set-ItemProperty -Path $keyPath -Name "StartLayoutFile" -Value $layoutFile
  934. }
  935.  
  936. #Restart Explorer, open the start menu (necessary to load the new layout), and give it a few seconds to process
  937. Stop-Process -name explorer
  938. Start-Sleep -s 5
  939. $wshell = New-Object -ComObject wscript.shell; $wshell.SendKeys('^{ESCAPE}')
  940. Start-Sleep -s 5
  941.  
  942. #Enable the ability to pin items again by disabling "LockedStartLayout"
  943. foreach ($regAlias in $regAliases){
  944.     $basePath = $regAlias + ":\SOFTWARE\Policies\Microsoft\Windows"
  945.     $keyPath = $basePath + "\Explorer"
  946.     Set-ItemProperty -Path $keyPath -Name "LockedStartLayout" -Value 0
  947. }
  948.  
  949. #Restart Explorer and delete the layout file
  950. Stop-Process -name explorer
  951.  
  952. # Uncomment the next line to make clean start menu default for all new users
  953. Import-StartLayout -LayoutPath $layoutFile -MountPath $env:SystemDrive\
  954.  
  955. Remove-Item $layoutFile
  956.  
  957.  
  958. # Prevents SYSPREP from freezing at "Getting Ready" on first boot                          #
  959. # NOTE, DMWAPPUSHSERVICE is a Keyboard and Ink telemetry service, and potential keylogger. #
  960. # It is recommended to disable this service in new builds, but SYSPREP will freeze/fail    #
  961. # if the service is not running. If SYSPREP will be used, add a FirstBootCommand to your   #
  962. # build to disable the service.                                                            #
  963.  
  964. reg delete "HKEY_LOCAL_MACHINE\SYSTEM\ControlSet001\Services\dmwappushservice" /v "DelayedAutoStart" /f
  965. reg add "HKEY_LOCAL_MACHINE\SYSTEM\ControlSet001\Services\dmwappushservice" /v "DelayedAutoStart" /t REG_DWORD /d "1"
  966. reg delete "HKEY_LOCAL_MACHINE\SYSTEM\ControlSet001\Services\dmwappushservice" /v "Start" /f
  967. reg add "HKEY_LOCAL_MACHINE\SYSTEM\ControlSet001\Services\dmwappushservice" /v "Start" /t REG_DWORD /d "2"
  968. # Add the line below to FirstBootCommand in answer file #
  969. # reg add "HKLM\Software\Microsoft\Windows\CurrentVersion\RunOnce" /v "disabledmwappushservice" /t REG_SZ /d "sc config dmwappushservice start= disabled"
  970.  
  971.  
  972. # Disable Privacy Settings Experience #
  973. # Also disables all settings in Privacy Experience #
  974.  
  975. reg delete "HKEY_LOCAL_MACHINE\SOFTWARE\Policies\Microsoft\Windows\OOBE" /v "DisablePrivacyExperience" /f
  976. reg add "HKEY_LOCAL_MACHINE\SOFTWARE\Policies\Microsoft\Windows\OOBE" /f
  977. reg add "HKEY_LOCAL_MACHINE\SOFTWARE\Policies\Microsoft\Windows\OOBE" /v "DisablePrivacyExperience" /t REG_DWORD /d "1" /f
  978. reg delete "HKEY_USERS\.DEFAULT\Software\Microsoft\Speech_OneCore\Settings\OnlineSpeechPrivacy" /v "HasAccepted" /f
  979. reg add "HKEY_USERS\.DEFAULT\Software\Microsoft\Speech_OneCore" /f
  980. reg add "HKEY_USERS\.DEFAULT\Software\Microsoft\Speech_OneCore\Settings" /f
  981. reg add "HKEY_USERS\.DEFAULT\Software\Microsoft\Speech_OneCore\Settings\OnlineSpeechPrivacy" /v "HasAccepted" /t REG_DWORD /d "0" /f
  982. reg delete "HKEY_CURRENT_USER\Software\Microsoft\Speech_OneCore\Settings\OnlineSpeechPrivacy" /v "HasAccepted" /f
  983. reg add "HKEY_CURRENT_USER\Software\Microsoft\Speech_OneCore" /f
  984. reg add "HKEY_CURRENT_USER\Software\Microsoft\Speech_OneCore\Settings" /f
  985. reg add "HKEY_CURRENT_USER\Software\Microsoft\Speech_OneCore\Settings\OnlineSpeechPrivacy" /v "HasAccepted" /t REG_DWORD /d "0" /f
  986. reg delete "HKEY_USERS\.DEFAULT\Software\Microsoft\Windows\CurrentVersion\CapabilityAccessManager\ConsentStore\location" /v "Value" /f
  987. reg add "HKEY_USERS\.DEFAULT\Software\Microsoft\Windows\CurrentVersion\CapabilityAccessManager" /f
  988. reg add "HKEY_USERS\.DEFAULT\Software\Microsoft\Windows\CurrentVersion\CapabilityAccessManager\ConsentStore" /f
  989. reg add "HKEY_USERS\.DEFAULT\Software\Microsoft\Windows\CurrentVersion\CapabilityAccessManager\ConsentStore\location" /v "Value" /t REG_SZ /d "Deny" /f
  990. reg delete "HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\CapabilityAccessManager\ConsentStore\location" /v "Value" /f
  991. reg add "HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\CapabilityAccessManager" /f
  992. reg add "HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\CapabilityAccessManager\ConsentStore" /f
  993. reg add "HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\CapabilityAccessManager\ConsentStore\location" /v "Value" /t REG_SZ /d "Deny" /f
  994. reg delete "HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Settings\FindMyDevice" /v "LocationSyncEnabled" /f
  995. reg add "HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Settings\FindMyDevice" /f
  996. reg add "HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Settings\FindMyDevice" /v "LocationSyncEnabled" /t REG_DWORD /d "0" /f
  997. reg delete "HKEY_USERS\.DEFAULT\SOFTWARE\Microsoft\Windows\CurrentVersion\Diagnostics\DiagTrack" /v "ShowedToastAtLevel" /f
  998. reg add "HKEY_USERS\.DEFAULT\SOFTWARE\Microsoft\Windows\CurrentVersion\Diagnostics" /f
  999. reg add "HKEY_USERS\.DEFAULT\SOFTWARE\Microsoft\Windows\CurrentVersion\Diagnostics\DiagTrack" /f
  1000. reg add "HKEY_USERS\.DEFAULT\SOFTWARE\Microsoft\Windows\CurrentVersion\Diagnostics\DiagTrack" /v "ShowedToastAtLevel" /t REG_DWORD /d "1" /f
  1001. reg delete "HKEY_CURRENT_USER\SOFTWARE\Microsoft\Windows\CurrentVersion\Diagnostics\DiagTrack" /v "ShowedToastAtLevel" /f
  1002. reg add "HKEY_CURRENT_USER\SOFTWARE\Microsoft\Windows\CurrentVersion\Diagnostics" /f
  1003. reg add "HKEY_CURRENT_USER\SOFTWARE\Microsoft\Windows\CurrentVersion\Diagnostics\DiagTrack" /f
  1004. reg add "HKEY_CURRENT_USER\SOFTWARE\Microsoft\Windows\CurrentVersion\Diagnostics\DiagTrack" /v "ShowedToastAtLevel" /t REG_DWORD /d "1" /f
  1005. reg delete "HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Policies\DataCollection" /v "AllowTelemetry" /f
  1006. reg add "HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Policies" /f
  1007. reg add "HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Policies\DataCollection" /f
  1008. reg add "HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Policies\DataCollection" /v "AllowTelemetry" /t REG_DWORD /d "1" /f
  1009. reg delete "HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Policies\DataCollection" /v "MaxTelemetryAllowed" /f
  1010. reg add "HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Policies\DataCollection" /v "MaxTelemetryAllowed" /t REG_DWORD /d "1" /f
  1011. reg delete "HKEY_USERS\.DEFAULT\Software\Microsoft\Input\TIPC" /v "Enabled" /f
  1012. reg add "HKEY_USERS\.DEFAULT\Software\Microsoft\Input" /f
  1013. reg add "HKEY_USERS\.DEFAULT\Software\Microsoft\Input\TIPC" /f
  1014. reg add "HKEY_USERS\.DEFAULT\Software\Microsoft\Input\TIPC" /v "Enabled" /t REG_DWORD /d "0" /f
  1015. reg delete "HKEY_CURRENT_USER\Software\Microsoft\Input\TIPC" /v "Enabled" /f
  1016. reg add "HKEY_CURRENT_USER\Software\Microsoft\Input" /f
  1017. reg add "HKEY_CURRENT_USER\Software\Microsoft\Input\TIPC" /f
  1018. reg add "HKEY_CURRENT_USER\Software\Microsoft\Input\TIPC" /v "Enabled" /t REG_DWORD /d "0" /f
  1019. reg delete "HKEY_USERS\.DEFAULT\Software\Microsoft\Windows\CurrentVersion\Privacy" /v "TailoredExperiencesWithDiagnosticDataEnabled" /f
  1020. reg add "HKEY_USERS\.DEFAULT\Software\Microsoft\Windows\CurrentVersion\Privacy" /f
  1021. reg add "HKEY_USERS\.DEFAULT\Software\Microsoft\Windows\CurrentVersion\Privacy" /v "TailoredExperiencesWithDiagnosticDataEnabled" /t REG_DWORD /d "0" /f
  1022. reg delete "HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Privacy" /v "TailoredExperiencesWithDiagnosticDataEnabled" /f
  1023. reg add "HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Privacy" /f
  1024. reg add "HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Privacy" /v "TailoredExperiencesWithDiagnosticDataEnabled" /t REG_DWORD /d "0" /f
  1025. reg delete "HKEY_USERS\.DEFAULT\Software\Microsoft\Windows\CurrentVersion\AdvertisingInfo" /v "Enabled" /f
  1026. reg add "HKEY_USERS\.DEFAULT\Software\Microsoft\Windows\CurrentVersion\AdvertisingInfo" /f
  1027. reg add "HKEY_USERS\.DEFAULT\Software\Microsoft\Windows\CurrentVersion\AdvertisingInfo" /v "Enabled" /t REG_DWORD /d "0" /f
  1028. reg delete "HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\AdvertisingInfo" /v "Enabled" /f
  1029. reg add "HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\AdvertisingInfo" /f
  1030. reg add "HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\AdvertisingInfo" /v "Enabled" /t REG_DWORD /d "0" /f
  1031.  
  1032.  
  1033. # Set Windows to Dark Mode #
  1034.  
  1035. reg add "HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Themes" /f
  1036. reg add "HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Themes" /v "AppsUseLightTheme" /t "REG_DWORD" /d "0" /f
  1037. reg add "HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Themes" /v "SystemUsesLightTheme" /t "REG_DWORD" /d "0" /f
  1038. reg add "HKEY_CURRENT_USER\SOFTWARE\Microsoft\Windows\CurrentVersion\Themes" /f
  1039. reg add "HKEY_CURRENT_USER\SOFTWARE\Microsoft\Windows\CurrentVersion\Themes\Personalize" /f
  1040. reg add "HKEY_CURRENT_USER\SOFTWARE\Microsoft\Windows\CurrentVersion\Themes\Personalize" /v "AppsUseLightTheme" /t "REG_DWORD" /d "0" /f
  1041. reg add "HKEY_CURRENT_USER\SOFTWARE\Microsoft\Windows\CurrentVersion\Themes\Personalize" /v "SystemUsesLightTheme" /t "REG_DWORD" /d "0" /f
  1042. reg add "HKEY_USERS\.DEFAULT\SOFTWARE\Microsoft\Windows\CurrentVersion\Themes" /f
  1043. reg add "HKEY_USERS\.DEFAULT\SOFTWARE\Microsoft\Windows\CurrentVersion\Themes\Personalize" /f
  1044. reg add "HKEY_USERS\.DEFAULT\SOFTWARE\Microsoft\Windows\CurrentVersion\Themes\Personalize" /v "AppsUseLightTheme" /t "REG_DWORD" /d "0" /f
  1045. reg add "HKEY_USERS\.DEFAULT\SOFTWARE\Microsoft\Windows\CurrentVersion\Themes\Personalize" /v "SystemUsesLightTheme" /t "REG_DWORD" /d "0" /f
  1046.  
  1047. ##########
  1048. # Restart
  1049. ##########
  1050. Write-Host
  1051. Write-Host "Press any key to restart your system..." -ForegroundColor Black -BackgroundColor White
  1052. $key = $host.UI.RawUI.ReadKey("NoEcho,IncludeKeyDown")
  1053. Write-Host "Restarting..."
  1054. Restart-Computer
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement