Advertisement
Guest User

WindowsConfig.ps1

a guest
Jun 22nd, 2017
2,478
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. # Windows 10 Inital Setup configuration script
  2. ##
  3.  
  4. # DISCLAMER: This script is provided "as-is" and must be modified to fit your envrionment
  5. # The original developer cannot be held accountable for your failure to read the fine print
  6. ##
  7.  
  8. # Ask for elevated permission
  9. ##
  10. If (!([Security.Principal.WindowsPrincipal][Security.Principal.WindowsIdentity]::GetCurrent()).IsInRole([Security.Principal.WindowsBuiltInRole]"Administrator")) {
  11.     Start-Process powershell.exe "-noProfile -ExecutionPolicy Bypass -File `"$PSCommandPath`"" -Verb RunAs
  12.     Exit
  13. }
  14.  
  15. Write-Host
  16. Write-Host "WARNING!!! Serious system instability can ocour if this script is interrupted" -ForegroundColor Black -BackgroundColor White
  17. Write-Host "Please take this time to create a restore image of your system, so that if this script fails, you can restore to a fresh install" -ForegroundColor Black -BackgroundColor White
  18. Write-Host
  19. Write-Host "DISCLAMER: This script is provided 'as-is' and must be modified to fit your envrionment" -ForegroundColor Black -BackgroundColor White
  20. Write-Host "The original developer cannot be held accountable for your failure to read the fine print" -ForegroundColor Black -BackgroundColor White
  21. Write-Host "By pressing 'Enter' you accept these terms, If you do not agree, end this program" -ForegroundColor Black -BackgroundColor White
  22. Write-Host "Press [Enter] to begin..." -ForegroundColor Black -BackgroundColor White
  23. $key = $host.UI.RawUI.ReadKey("NoEcho,IncludeKeyDown")
  24.  
  25. Write-Host
  26. Write-Host "Would you like to create a system restore point before continuing..."
  27. $ReadHost = Read-Host " ( Y / N ) "
  28. Switch ($ReadHost) {
  29.     Y {Read-Host "Creating system restore point..."; Enable-ComputerRestore -Drive "C:\" -Confirm; wmic.exe /Namespace:\\root\default Path SystemRestore Call CreateRestorePoint "Restore point created before WindowsConfig", 100, 12}
  30.     N {Read-Host "Continuing Script..."}
  31.     Default {Read-Host "Continuing Scipt..."}
  32. }
  33.  
  34. ##
  35. # Privicy Settings
  36. ##
  37.  
  38. Write-Host
  39. Write-Host "##"
  40. Write-Host "# Modifing Privicy Settings #"
  41. Write-Host "##"
  42. Write-Host
  43.  
  44. # Disable Telemetry
  45. ##
  46. Write-Host "Disabling Telemetry"
  47.  
  48. Set-ItemProperty -Path "HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\Policies\DataCollection" -Name "AllowTelemetry" -Type DWord -Value 0
  49. If ((Test-Path "HKLM:\SOFTWARE\Policies\Microsoft\Windows\DataCollection")) {
  50.      New-item -Path "HKLM:\SOFTWARE\Policies\Microsoft\Windows\DataCollection" -Force | Out-Null
  51. }
  52. Set-ItemProperty -Path "HKLM:\SOFTWARE\Policies\Microsoft\Windows\DataCollection" -Name "AllowTelemetry" -Type DWord -Value 0 -Force
  53. Set-ItemProperty -Path "HKLM:\SOFTWARE\Wow6432Node\Microsoft\Windows\CurrentVersion\Policies\DataCollection" -Name "AllowTelemetry" -Type DWord -Value 0
  54.  
  55. # Disable Wi-Fi Sense
  56. ##
  57. Write-Host "Disabling WiFi Sense"
  58.  
  59. If (!(Test-Path "HKLM:\SOFTWARE\Microsoft\PolicyManager\default\WiFi\AllowWiFiHotSpotReporting")) {
  60.     New-Item -Path "HKLM:\SOFTWARE\Microsoft\PolicyManager\default\WiFi\AllowWiFiHotSpotReporting" -Force | Out-Null
  61. }
  62. Set-ItemProperty -Path "HKLM:\SOFTWARE\Microsoft\PolicyManager\default\WiFi\AllowWiFiHotSpotReporting" -Name "Value" -Type DWord -Value 0
  63. Set-ItemProperty -Path "HKLM:\SOFTWARE\Microsoft\PolicyManager\default\WiFi\AllowAutoConnectToWiFiSenseHotspots" -Name "Value" -Type DWord -Value 0
  64.  
  65. # Enable Windows SmartScreen Filter
  66. ##
  67. Write-Host "Enabling Windows SmartScreen Filter"
  68.  
  69. Set-ItemProperty -Path "HKLM:\Software\Microsoft\Windows\CurrentVersion\Explorer" -Name "SmartScreenEnabled" -Type String -Value "RequireAdmin"
  70.  
  71. # Raise UAC Level
  72. ##
  73. Write-host "Rasing UAC Level"
  74.  
  75. Set-ItemProperty -Path "HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\Policies\System" -Name "ConcentPromptBehaviorAdmin" -Type DWord -Value 1
  76. Set-ItemProperty -Path "HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\Policies\System" -Name "ConcentPromptBehaviorUser" -Type DWord -Value 3
  77. Set-ItemProperty -Path "HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\Policies\System" -Name "PromptOnSecureDesktop" -Type DWord -Value 1
  78.  
  79. # Disable Bing Search in Start Menu
  80. ##
  81. Write-Host "Disabling Bing Search in Start Menu"
  82.  
  83. Set-ItemProperty -Path "HKCU:\SOFTWARE\Microsoft\Windows\CurrentVersion\Search" -Name "BingSearchEnabled" -Type Dword -Value 0
  84.  
  85. # Disable Start Menu Suggestions
  86. ##
  87. Write-Host "Disabling Start Menu Suggestions"
  88.  
  89. Set-ItemProperty -Path "HKCU:\SOFTWARE\Microsoft\Windows\CurrentVersion\ContentDeliveryManager" -Name "SystemPaneSuggestionsEnabled" -Type DWord -Value 0
  90.  
  91. # Disable Location Tracking
  92. ##
  93. Write-Host "Disabling Location Tracking"
  94.  
  95. Set-ItemProperty -Path "HKLM:\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Sensor\Overrides\{BFA794E4-F964-4FDB-90F6-51056BFE4B44}" -Name "SensorPermissionState" -Type DWord -Value 0
  96. Set-ItemProperty -Path "HKLM:\SYSTEM\CurrentControlSet\Services\lfsvc\Service\Configuration" -Name "Status" -Type DWord -Value 0
  97.  
  98. # Disable Feedback
  99. ##
  100. Write-Host "Disabling Feedback"
  101.  
  102. If (!(Test-Path "HKCU:\SOFTWARE\Microsoft\Siuf\Rules")) {
  103.     New-Item -Path "HKCU:\SOFTWARE\Microsoft\Siuf\Rules" -Force | Out-Null
  104. }
  105. Set-ItemProperty -Path "HKCU:\SOFTWARE\Microsoft\Siuf\Rules" -Name "NumberOfSIUFInPeriod" -Type DWord -Value 0
  106.  
  107. # Disable Advertising ID
  108. ##
  109. Write-Host "Disabling Advertising ID"
  110.  
  111. If (!(Test-Path "HKCU:\SOFTWARE\Microsoft\Windows\CurrentVersion\AdvertisingInfo")) {
  112.     New-Item -Path "HKCU:\SOFTWARE\Microsoft\Windows\CurrentVersion\AdvertisingInfo" | Out-Null
  113. }
  114. Set-ItemProperty "HKCU:\SOFTWARE\Microsoft\Windows\CurrentVersion\AdvertisingInfo" -Name "Enabled" -Type DWord -Value 0
  115.  
  116. # Disable Cortana
  117. ##
  118. Write-Host "Disabling Cortana"
  119.  
  120. If (!(Test-Path "HKCU:\SOFTWARE\Microsoft\Personalization\Settings")) {
  121.     New-Item -Path "HKCU:\SOFTWARE\Microsoft\Personalization\Settings" -Force | Out-Null
  122. }
  123. Set-ItemProperty -Path "HKCU:\SOFTWARE\Microsoft\Personalization\Settings" -Name "AcceptedPrivicyPolicy" -Type DWord -Value 0
  124. If (!(Test-Path "HKCU:\SOFTWARE\Microsoft\InputPersonalization")) {
  125.     New-Item -Path "HKCU:\SOFTWARE\Microsoft\InputPersonalization" -Force | Out-Null
  126. }
  127. Set-ItemProperty -Path "HKCU:\SOFTWARE\Microsoft\InputPersonalization" -Name "RestrictImplicitTextCollection" -Type DWord -Value 1
  128. Set-ItemProperty -Path "HKCU:\SOFTWARE\Microsoft\InputPersonalization" -Name "RestrictImplicitInkCollection" -Type DWord -Value 1
  129. If (!(Test-Path "HKCU:\SOFTWARE\Microsoft\InputPersonalization\TrainedDataStore")) {
  130.     New-Item -Path "HKCU:\SOFTWARE\Microsoft\InputPersonalization\TrainedDataStore" -Force | Out-Null
  131. }
  132. Set-ItemProperty -Path "HKCU:\SOFTWARE\Microsoft\InputPersonalization\TrainedDataStore" -Name "HarvestContacts" -Type DWord -Value 0
  133. If (!(Test-Path "HKLM:\SOFTWARE\Policies\Microsoft\Windows\Windows Search")) {
  134.     New-Item -Path "HKLM:\SOFTWARE\Policies\Microsoft\Windows\Windows Search" -Force | Out-Null
  135. }
  136. New-ItemProperty -Path "HKLM:\SOFTWARE\Policies\Microsoft\Windows\Windows Search" -Name "AllowCortana" -PropertyType DWord -Value 0 -Force
  137.  
  138. # Restrict Windows Update to Internet Download only
  139. ##
  140. Write-Host "Restricting Windows Update to Internet Download only"
  141.  
  142. Set-ItemProperty -Path "HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\DeliveryOptimization\Config" -Name "DODownloadMode" -Type DWord -Value 0
  143. If (!(Test-Path "HKCU:\SOFTWARE\Microsoft\Windows\CurrentVersion\DeliveryOptimization")) {
  144.     New-Item -Path "HKCU:\SOFTWARE\Microsoft\Windows\CurrentVersion\DeliveryOptimization" | Out-Null
  145. }
  146. Set-ItemProperty -Path "HKCU:\SOFTWARE\Microsoft\Windows\CurrentVersion\DeliveryOptimization" -Name "SystemSettingsDownloadMode" -Type DWord -Value 0
  147.  
  148. # Set Windows Update to Auto Download and Install (strictly for later on in script for downloading all updates, will be changed after
  149. ##
  150. Write-Host "Setting Windows Update to auto"
  151.  
  152. if (!(Test-Path "HKLM:\SOFTWARE\Policies\Microsoft\Windows\WindowsUpdate")) {
  153.     New-Item -Path "HKLM:\SOFTWARE\Policies\Microsoft\Windows\WindowsUpdate" | Out-Null
  154. }
  155. if (!(Test-Path -Path "HKLM:\SOFTWARE\Policies\Microsoft\Windows\WindowsUpdate\AU")) {
  156.     New-Item -Path "HKLM:\SOFTWARE\Policies\Microsoft\Windows\WindowsUpdate\AU" | Out-Null
  157. }
  158. New-ItemProperty -Path "HKLM:\SOFTWARE\Policies\Microsoft\Windows\WindowsUpdate\AU" -Name "AUOptions" -PropertyType DWord -Value 4
  159.  
  160. # Remove AutoLogger and restrict directory
  161. ##
  162. Write-Host "Removing AutoLogger and restrict directoy"
  163.  
  164. $autoLoggerDir = "$env:PROGRAMDATA\Microsoft\Diagnosis\ETLLogs\AutoLogger"
  165. If (Test-Path "$autoLoggerDir\AutoLogger-Diagtrack-Listener.etl") {
  166.     Remove-Item "$autoLoggerDir\AutoLogger-Diagtrack-Listener.etl"
  167. }
  168. icacls $autoLoggerDir /deny SYSTEM:`(OI`)`(CI`)F | Out-Null
  169.  
  170. # Stop and disable Diagnostics Tracking
  171. ##
  172. Write-Host "Disabling Diagnostics Tracking"
  173.  
  174. Stop-Service "DiagTrack"
  175. Set-Service "DiagTrack" -StartupType Disabled
  176.  
  177. # Stop and disable WAP Push Service
  178. ##
  179. Write-Host "Disabling WAP Push Service"
  180.  
  181. Stop-Service "dmwappushservice"
  182. Set-Service "dmwappushservice" -StartupType Disabled
  183.  
  184. # Disable Microsoft Suggested Apps
  185. ##
  186. Write-Host "Disabling Microsoft Suggested Apps"
  187.  
  188. Set-ItemProperty -Path "HKCU:\SOFTWARE\Microsoft\Windows\CurrentVersion\ContentDeliveryManager" -Name "SystemPaneSuggestionsEnabled" -Type DWord -Value 0
  189.  
  190. # Disable Windows Consumer Features
  191. ##
  192. Write-Host "Disabling Windows Consumer Features"
  193.  
  194. If (!(Test-Path "HKLM:\SOFTWARE\Policies\Microsoft\Windows\CloudContent")) {
  195.     New-Item -Path "HKLM:\SOFTWARE\Policies\Microsoft\Windows\CloudContent" | Out-Null
  196. }
  197. New-ItemProperty -Path "HKLM:\SOFTWARE\Policies\Microsoft\Windows\CloudContent" -Name "DisableWindowsConsumerFeatures" -Value 1 -PropertyType DWord -Force
  198.  
  199. # Disable Windows Tips and Feedback
  200. ##
  201. Write-Host "Disabling Windows Tips and feedback"
  202.  
  203. Set-ItemProperty -Path "HKCU:\SOFTWARE\Microsoft\Windows\CurrentVersion\ContentDeliveryManager" -Name "SoftLandingEnabled" -Type DWord -Value 0
  204.  
  205. # Disable Windows Lockscreen Spotlight
  206. ##
  207. #Write-host "Disabling Windows Lockscreen Spotlight"
  208.  
  209. #Set-ItemProperty -Path "HKCU:\SOFTWARE\Microsoft\Windows\CurrentVersion\ContentDeliveryManager" -Name "RotatingLockScreenEnabled" -Type DWord -Value 0
  210.  
  211. # Enable Windows Powershell remoting without domain
  212. ##
  213. Write-Host "Enabling Windows Powershell remoting without domain"
  214.  
  215. winrm quickconfig
  216. Set-Item WSMan:\localhost\Client\TrustedHosts -Value "*" -Force
  217.  
  218. # Disable Windows GameDVR
  219. ##
  220. Write-host "Disabling Windows GameDVR"
  221.  
  222. if (!(Test-Path "HKLM:\SOFTWARE\Policies\Microsoft\Windows\GameDVR")) {
  223.     New-Item -Path "HKLM:\SOFTWARE\Policies\Microsoft\Windows\GameDVR" | Out-Null
  224. }
  225. New-ItemProperty -Path "HKLM:\SOFTWARE\Policies\Microsoft\Windows\GameDVR" -Name "AllowGameDVR" -Value 0 -PropertyType DWord -Force
  226. Set-ItemProperty -Path "HKCU:\System\GameConfigStore" -Name "GameDVR_Enabled" -Type DWord -Value 0
  227. New-ItemProperty -Path "HKCU:\SOFTWARE\Microsoft\Windows\CurrentVersion\GameDVR" -Name "AppCaptureEnabled" -Value 0 -PropertyType DWord -Force
  228.  
  229. # Disable AutoPlay
  230. ##
  231. Write-Host "Disabling AutoPlay"
  232.  
  233. Set-ItemProperty -Path "HKCU:\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\AutoPlayHandlers" -Name "DisableAutoPlay" -Type DWord -Value 1
  234.  
  235. # Disable AutoRun for all drives
  236. ##
  237. Write-Host "Disabling AutoRun for all drives"
  238.  
  239. if (!(Test-Path "HKCU:\SOFTWARE\Microsoft\Windows\CurrentVersion\Policies\Explorer")) {
  240.     New-Item -Path "HKCU:\SOFTWARE\Microsoft\Windows\CurrentVersion\Policies\Explorer" | Out-Null
  241. }
  242. Set-ItemProperty -Path "HKCU:\SOFTWARE\Microsoft\Windows\CurrentVersion\Policies\Explorer" -Name "NoDriveTypeAutoRun" -Type DWord -Value 255
  243.  
  244. ##
  245. # Service Tasks
  246. ##
  247.  
  248. Write-Host
  249. Write-Host "##"
  250. Write-Host "# Modifing Service Tasks #"
  251. Write-Host "##"
  252. Write-Host
  253.  
  254. # Enable Firewall
  255. ##
  256. Write-Host "Enabling Windows Firewall"
  257.  
  258. Set-NetFirewallProfile -Profile * -Enabled True
  259.  
  260. # Configure Windows Defender
  261. ##
  262.  
  263. Write-Host "Configuring Windows Defender"
  264.  
  265. Set-MpPreference -CheckForSignaturesBeforeRunningScan $True
  266. Set-MpPreference -DisableArchiveScanning $False
  267. Set-MpPreference -DisableBehaviorMonitoring $False
  268. Set-MpPreference -DisableBlockAtFirstSeen $False
  269. Set-MpPreference -DisableEmailScanning $False
  270. Set-MpPreference -DisableIOAVProtection $False
  271. Set-MpPreference -DisableIntrusionPreventionSystem $False
  272. Set-MpPreference -DisableRealtimeMonitoring $False
  273. Set-MpPreference -DisableRemovableDriveScanning $False
  274. Set-MpPreference -DisableScriptScanning $False
  275. Set-MpPreference -DisableScanningMappedNetworkDrivesForFullScan $True
  276. Set-MpPreference -DisableScanningNetworkFiles $True
  277. Set-MpPreference -HighThreatDefaultAction Quarantine
  278. Set-MpPreference -LowThreatDefaultAction Quarantine
  279. Set-MpPreference -MAPSReporting Advanced
  280. Set-MpPreference -ModerateThreatDefaultAction Quarantine
  281. Set-MpPreference -PUAProtection Enabled
  282. Set-MpPreference -RealTimeScanDirection Both
  283. Set-MpPreference -ScanParameters QuickScan
  284. Set-MpPreference -ScanScheduleDay Everyday
  285. Set-MpPreference -SevereThreatDefaultAction Quarantine
  286. Set-MpPreference -SignatureUpdateInterval 60
  287. Set-MpPreference -SignatureFallbackOrder {MMPC | MicrosoftUpdateServer}
  288. Set-MpPreference -SubmitSamplesConsent Always
  289. Set-MpPreference -UnknownThreatDefaultAction Quarantine
  290.  
  291. Get-MpPreference >> C:\WindowsDefenderSettings.txt
  292.  
  293. # Disable Windows Update Automatic restart
  294. ##
  295. Write-Host "Disabling Window Update Automatic restart"
  296.  
  297. Set-ItemProperty -Path "HKLM:\SOFTWARE\Microsoft\WindowsUpdate\UX\Settings" -Name "UxOption" -Type DWord -Value 1
  298.  
  299. # Stop and disable Home Group services
  300. ##
  301. Write-Host "Disabling Home Group services"
  302.  
  303. Stop-Service "HomeGroupListener"
  304. Set-Service "HomeGroupListener" -StartupType Disabled
  305. Stop-Service "HomeGroupProvider"
  306. Set-Service "HomeGroupProvider" -StartupType Disabled
  307.  
  308. # Disable Lock Screen (Anniversary Update workaround)
  309. ##
  310. Write-Host "Disabling Lock Screen (Anniversary Update workaround)"
  311.  
  312. If ([System.Environment]::OSVersion.Build -gt 14392) {
  313.        $service = New-Object -com Schedule.Service
  314.        $service.Connect()
  315.        $task = $service.NewTask(0)
  316.        $task.Settings.DisallowStartIfOnBatteries = $False
  317.        $trigger = $task.Triggers.Create(9)
  318.        $trigger = $task.Triggers.Create(11)
  319.        $trigger.StateChange = 8
  320.        $action = $task.Actions.Create(0)
  321.        $action.Path = "reg.exe"
  322.        $action.Arguments = "add HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Authentication\LogonUI\SessionData /t REG_DWORD /v AllowLockScreen /d 0 /f"
  323.        $service.GetFolder("\").RegisterTaskDevinition("Disable LockScreen", $task, 6, "NT AUTHORITY\SYSTEM", $null, 4) | Out-Null
  324. }
  325.  
  326. ##
  327. # Remove Unwanted Applications
  328. ##
  329.  
  330. Write-Host
  331. Write-Host "##"
  332. Write-Host "# Removing Unwanted Applications #"
  333. Write-Host "##"
  334. Write-Host
  335.  
  336. # Remove OneDrive
  337. ##
  338. Write-Host "Removing OneDrive"
  339.  
  340. Stop-Process -Name OneDrive -ErrorAction SilentlyContinue
  341. Start-Sleep -s 3
  342. $oneDrive = "$env:SYSTEMROOT\SysWOW64\OneDriveSetup.exe"
  343. If (!(Test-Path $oneDrive)) {
  344.     $oneDrive = "$env:SYSTEMROOT\System32\OneDriveSetup.exe"
  345. }
  346. Start-Process $oneDrive "/uninstall" -NoNewWindow -Wait
  347. Start-Sleep -s 3
  348. Stop-Process -Name Explorer -ErrorAction SilentlyContinue
  349. Start-Sleep -s 3
  350. Remove-Item "$env:USERPROFILE\OneDrive" -Force -Recurse -ErrorAction SilentlyContinue
  351. Remove-Item "$env:LOCAPAPPDATA\Microsoft\OneDrive" -Force -Recurse -ErrorAction SilentlyContinue
  352. Remove-Item "$env:PROGRAMDATA\Microsoft\Microsoft Onedrive" -Force -Recurse -ErrorAction SilentlyContinue
  353. If (Test-Path "$env:SYSTEMDRIVE\OneDriveTemp") {
  354.     Remove-item "$env:SYSTEMDRIVE\OneDriveTemp" -Force -Recurse -ErrorAction SilentlyContinue
  355. }
  356. If (!(Test-Path "HKCR:")) {
  357.     New-PSDrive -Name HKCR -PSProvider Registry -Root HKEY_CLASSES_ROOT | Out-Null
  358. }
  359. Remove-Item -Path "HKCR:\CLSID\{018D5C66-4533-4307-9B53-224DE2ED1FE6}" -Recurse -ErrorAction SilentlyContinue
  360. Remove-Item -Path "HKCR:\Wow6432Node\CLSID\{018D5C66-4533-4307-9B53-224DE2ED1FE6}" -Recurse -ErrorAction SilentlyContinue
  361.  
  362. # Remove OneDrive ads being displayed in Explorer (Creators Update)
  363. ##
  364. Write-Host "Removing OneDrive ads being displayed in Explorer (Creators Update)"
  365.  
  366. Set-ItemProperty -Path HKCU:\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\Advanced\ -name ShowSyncProviderNotifications -Value 0
  367.  
  368. # Remove Default bloatware
  369. ##
  370. Write-Host "Removing default bloatware"
  371.  
  372. Write-Host "Removing BingWeather"
  373. Get-AppxPackage -AllUsers -Name Microsoft.BingWeather | Remove-AppxPackage
  374.  
  375. Write-Host "Removing WindowsMaps"
  376. Get-AppxPackage -AllUsers -Name Microsoft.WindowsMaps | Remove-AppxPackage
  377.  
  378. Write-Host "Removing OneConnect"
  379. Get-AppxPackage -AllUsers -Name Microsoft.OneConnect | Remove-AppxPackage
  380.  
  381. Write-Host "Removing Messaging"
  382. Get-AppxPackage -AllUsers -Name Microsoft.Messaging | Remove-AppxPackage
  383.  
  384. Write-Host "Removing 3DBuilder"
  385. Get-AppxPackage -AllUsers -Name Microsoft.3DBuilder | Remove-AppxPackage
  386.  
  387. Write-Host "Removing WindowsFeedbackHub"
  388. Get-AppxPackage -AllUsers -Name Microsoft.WindowsFeedbackHub | Remove-AppxPackage
  389.  
  390. Write-Host "Removing WindowsCamera"
  391. Get-AppxPackage -AllUsers -Name Microsoft.WindowsCamera | Remove-AppxPackage
  392.  
  393. Write-Host "Removing GetStarted"
  394. Get-AppxPackage -AllUsers -Name Microsoft.GetStarted | Remove-AppxPackage
  395.  
  396. Write-Host "Removing ZuneVideo"
  397. Get-AppxPackage -AllUsers -Name Microsoft.ZuneVideo | Remove-AppxPackage
  398.  
  399. Write-Host "Removing Twitter"
  400. Get-AppxPackage -AllUsers -Name *Twitter* | Remove-AppxPackage
  401.  
  402. Write-Host "Removing Netflix"
  403. Get-AppxPackage -AllUsers -Name *Netflix* | Remove-AppxPackage
  404.  
  405. Write-Host "Removing People"
  406. Get-AppxPackage -AllUsers -Name Microsoft.People | Remove-AppxPackage
  407.  
  408. Write-Host "Removing ZuneMusic"
  409. Get-AppxPackage -AllUsers -Name Microsoft.ZuneMusic | Remove-AppxPackage
  410.  
  411. Write-Host "Removing SkypeApp"
  412. Get-AppxPackage -AllUsers -Name *SkypeApp* | Remove-AppxPackage
  413.  
  414. Write-Host "Removing WindowsSoundRecorder"
  415. Get-AppxPackage -AllUsers -Name Microsoft.WindowsSoundRecorder | Remove-AppxPackage
  416.  
  417. Write-Host "Removing MicrosoftStickyNotes"
  418. Get-AppxPackage -AllUsers -Name Microsoft.MicrosoftStickyNotes | Remove-AppxPackage
  419.  
  420. Write-Host "Removing WindowsAlarms"
  421. Get-AppxPackage -AllUsers -Name Microsft.WindowsAlarms | Remove-AppxPackage
  422.  
  423. Write-Host "Removing MicrosoftSolitaireCollection"
  424. Get-AppxPackage -AllUsers -Name Microsoft.MicrosoftSolitaireCollection | Remove-AppxPackage
  425.  
  426. Write-host "Removing Facebook"
  427. Get-AppxPackage -AllUsers -Name *Facebook* | Remove-AppxPackage
  428.  
  429. Write-host "Removing Minecraft"
  430. Get-AppxPackage -AllUsers -Name *Minecraft* | Remove-AppxPackage
  431.  
  432. Write-Host "Removing CandyCrush"
  433. Get-AppxPackage -AllUsers -Name King.com.CandyCrushSodaSaga | Remove-AppxPackage
  434.  
  435. Write-Host "Removing TuneInRadio"
  436. Get-AppxPackage -AllUsers -Name TuneIn.TuneInRadio | Remove-AppxPackage
  437.  
  438. Write-Host "Removing PicsArt PhotoStudio"
  439. Get-AppxPackage -AllUsers -Name 2FE3CB00.PicsArt-PhotoStudio | Remove-AppxPackage
  440.  
  441. Write-Host "Removing Xbox Apps"
  442. Get-AppxPackage -AllUsers -Name Microsoft.XboxIdentityProvider | Remove-AppxPackage
  443. Get-AppxPackage -AllUsers -Name Microsoft.XboxSpeechToTextOverlay | Remove-AppxPackage
  444. Get-AppxPackage -AllUsers -Name Microsoft.XboxApp | Remove-AppxPackage
  445.  
  446. # Remove New Microsoft Edge Button in IE
  447. ##
  448. Write-Host "Removing 'Open in Edge' button in IE"
  449.  
  450. Set-ItemProperty -Path "HKCU:\SOFTWARE\Microsoft\Internet Explorer\Main" -Name "HideNewEdgeButton" -Value 1 -Type DWord -Force
  451.  
  452. # Disable SMBv1
  453. ##
  454. Write-Host "Disabling SMBv1"
  455.  
  456. Disable-WindowsOptionalFeature -Online -FeatureName SMB1Protocol -NoRestart
  457.  
  458. ##
  459. # Windows Update and image service tasks
  460. ##
  461.  
  462. # Download latest Windows 10 Updates
  463. ##
  464. Write-Host "Downloading latest Windows 10 Updates"
  465.  
  466. wuauclt.exe /ResetAuthorization /detectnow /updatenow
  467. Start-Sleep -Seconds 600
  468.  
  469. # Set Windows Update to Notify for Download and Install
  470. ##
  471. Write-Host "Setting Windows Update to Notify for Download and Install"
  472.  
  473. Set-ItemProperty -Path "HKLM:\SOFTWARE\Policies\Microsoft\Windows\WindowsUpdate\AU" -Name "AUOptions" -Type DWord -Value 2
  474.  
  475. # Dism online image base reset
  476. ##
  477. Write-Host "Performing dism base reset"
  478.  
  479. dism.exe /Online /Cleanup-Image /StartComponentCleanup /ResetBase
  480.  
  481. # Dism online image repair
  482. ##
  483. write-host "Performing dism image check and repair"
  484.  
  485. dism.exe /Online /Cleanup-Image /RestoreHealth
  486.  
  487. ##
  488. # Windows End-of-script tasks
  489. ##
  490.  
  491. Write-Host
  492. Write-Host "##"
  493. Write-Host "# End-of-script tasks #"
  494. Write-Host "##"
  495. Write-Host
  496.  
  497. # Enable boot menu
  498. ##
  499. Write-Host "Enabling boot menu"
  500.  
  501. bcdedit --% /set {bootmgr} displaybootmenu true
  502. bcdedit --% /set {bootmgr} timeout 7
  503.  
  504. # Restart
  505. ##
  506.  
  507. Write-Host "Script execution complete, Would you like to reboot now?"
  508. $ReadHost = Read-Host " ( Y / N ) "
  509. Switch ($ReadHost) {
  510.     Y {Write-Host "Rebooting..."; Restart-Computer}
  511.     N {Write-Host "Script End..." Exit}
  512.     Default {Write-Host "Script End..." Exit}
  513. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement