Windows10Debloater.ps1 42 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914
  1. #This function finds any AppX/AppXProvisioned package and uninstalls it, except for Freshpaint, Windows Calculator, Windows Store, and Windows Photos.
  2. #Also, to note - This does NOT remove essential system services/software/etc such as .NET framework installations, Cortana, Edge, etc.
  3. #This will self elevate the script so with a UAC prompt since this script needs to be run as an Administrator in order to function properly.
  4. If (!([Security.Principal.WindowsPrincipal][Security.Principal.WindowsIdentity]::GetCurrent()).IsInRole([Security.Principal.WindowsBuiltInRole]'Administrator')) {
  5. Write-Host "You didn't run this script as an Administrator. This script will self elevate to run as an Administrator and continue."
  6. Start-Sleep 1
  7. Write-Host " 3"
  8. Start-Sleep 1
  9. Write-Host " 2"
  10. Start-Sleep 1
  11. Write-Host " 1"
  12. Start-Sleep 1
  13. Start-Process powershell.exe -ArgumentList ("-NoProfile -ExecutionPolicy Bypass -File `"{0}`"" -f $PSCommandPath) -Verb RunAs
  14. Exit
  15. }
  16. #no errors throughout
  17. $ErrorActionPreference = 'silentlycontinue'
  18. $DebloatFolder = "C:\Temp\Windows10Debloater"
  19. If (Test-Path $DebloatFolder) {
  20. Write-Output "$DebloatFolder exists. Skipping."
  21. }
  22. Else {
  23. Write-Output "The folder '$DebloatFolder' doesn't exist. This folder will be used for storing logs created after the script runs. Creating now."
  24. Start-Sleep 1
  25. New-Item -Path "$DebloatFolder" -ItemType Directory
  26. Write-Output "The folder $DebloatFolder was successfully created."
  27. }
  28. Start-Transcript -OutputDirectory "$DebloatFolder"
  29. Add-Type -AssemblyName PresentationCore, PresentationFramework
  30. Function DebloatAll {
  31. #Removes AppxPackages
  32. #Credit to /u/GavinEke for a modified version of my whitelist code
  33. $WhitelistedApps = 'Microsoft.ScreenSketch|Microsoft.Paint3D|Microsoft.WindowsCalculator|Microsoft.WindowsStore|Microsoft.Windows.Photos|CanonicalGroupLimited.UbuntuonWindows|`
  34. Microsoft.XboxGameCallableUI|Microsoft.XboxGamingOverlay|Microsoft.Xbox.TCUI|Microsoft.XboxGamingOverlay|Microsoft.XboxIdentityProvider|Microsoft.MicrosoftStickyNotes|Microsoft.MSPaint|Microsoft.WindowsCamera|.NET|Framework|`
  35. Microsoft.HEIFImageExtension|Microsoft.ScreenSketch|Microsoft.StorePurchaseApp|Microsoft.VP9VideoExtensions|Microsoft.WebMediaExtensions|Microsoft.WebpImageExtension|Microsoft.DesktopAppInstaller|WindSynthBerry|MIDIBerry|Slack'
  36. #NonRemovable Apps that where getting attempted and the system would reject the uninstall, speeds up debloat and prevents 'initalizing' overlay when removing apps
  37. $NonRemovable = '1527c705-839a-4832-9118-54d4Bd6a0c89|c5e2524a-ea46-4f67-841f-6a9465d9d515|E2A4F912-2574-4A75-9BB0-0D023378592B|F46D4000-FD22-4DB4-AC8E-4E1DDDE828FE|InputApp|Microsoft.AAD.BrokerPlugin|Microsoft.AccountsControl|`
  38. Microsoft.BioEnrollment|Microsoft.CredDialogHost|Microsoft.ECApp|Microsoft.LockApp|Microsoft.MicrosoftEdgeDevToolsClient|Microsoft.MicrosoftEdge|Microsoft.PPIProjection|Microsoft.Win32WebViewHost|Microsoft.Windows.Apprep.ChxApp|`
  39. Microsoft.Windows.AssignedAccessLockApp|Microsoft.Windows.CapturePicker|Microsoft.Windows.CloudExperienceHost|Microsoft.Windows.ContentDeliveryManager|Microsoft.Windows.Cortana|Microsoft.Windows.NarratorQuickStart|`
  40. Microsoft.Windows.ParentalControls|Microsoft.Windows.PeopleExperienceHost|Microsoft.Windows.PinningConfirmationDialog|Microsoft.Windows.SecHealthUI|Microsoft.Windows.SecureAssessmentBrowser|Microsoft.Windows.ShellExperienceHost|`
  41. Microsoft.Windows.XGpuEjectDialog|Microsoft.XboxGameCallableUI|Windows.CBSPreview|windows.immersivecontrolpanel|Windows.PrintDialog|Microsoft.VCLibs.140.00|Microsoft.Services.Store.Engagement|Microsoft.UI.Xaml.2.0'|*Nvidia*
  42. Get-AppxPackage -AllUsers | Where-Object {$_.Name -NotMatch $WhitelistedApps -and $_.Name -NotMatch $NonRemovable} | Remove-AppxPackage
  43. Get-AppxPackage | Where-Object {$_.Name -NotMatch $WhitelistedApps -and $_.Name -NotMatch $NonRemovable} | Remove-AppxPackage
  44. Get-AppxProvisionedPackage -Online | Where-Object {$_.PackageName -NotMatch $WhitelistedApps -and $_.PackageName -NotMatch $NonRemovable} | Remove-AppxProvisionedPackage -Online
  45. }
  46. Function DebloatBlacklist {
  47. $Bloatware = @(
  48. #Unnecessary Windows 10 AppX Apps
  49. "Microsoft.BingNews"
  50. "Microsoft.GetHelp"
  51. "Microsoft.Getstarted"
  52. "Microsoft.Messaging"
  53. "Microsoft.Microsoft3DViewer"
  54. "Microsoft.MicrosoftOfficeHub"
  55. "Microsoft.MicrosoftSolitaireCollection"
  56. "Microsoft.NetworkSpeedTest"
  57. "Microsoft.News"
  58. "Microsoft.Office.Lens"
  59. "Microsoft.Office.OneNote"
  60. "Microsoft.Office.Sway"
  61. "Microsoft.OneConnect"
  62. "Microsoft.People"
  63. "Microsoft.Print3D"
  64. "Microsoft.RemoteDesktop"
  65. "Microsoft.SkypeApp"
  66. "Microsoft.StorePurchaseApp"
  67. "Microsoft.Office.Todo.List"
  68. "Microsoft.Whiteboard"
  69. "Microsoft.WindowsAlarms"
  70. #"Microsoft.WindowsCamera"
  71. "microsoft.windowscommunicationsapps"
  72. "Microsoft.WindowsFeedbackHub"
  73. "Microsoft.WindowsMaps"
  74. "Microsoft.WindowsSoundRecorder"
  75. "Microsoft.Xbox.TCUI"
  76. "Microsoft.XboxApp"
  77. "Microsoft.XboxGameOverlay"
  78. "Microsoft.XboxIdentityProvider"
  79. "Microsoft.XboxSpeechToTextOverlay"
  80. "Microsoft.ZuneMusic"
  81. "Microsoft.ZuneVideo"
  82. #Sponsored Windows 10 AppX Apps
  83. #Add sponsored/featured apps to remove in the "*AppName*" format
  84. "*EclipseManager*"
  85. "*ActiproSoftwareLLC*"
  86. "*AdobeSystemsIncorporated.AdobePhotoshopExpress*"
  87. "*Duolingo-LearnLanguagesforFree*"
  88. "*PandoraMediaInc*"
  89. "*CandyCrush*"
  90. "*Wunderlist*"
  91. "*Flipboard*"
  92. "*Twitter*"
  93. "*Facebook*"
  94. "*Spotify*"
  95. "*Minecraft*"
  96. "*Royal Revolt*"
  97. "*Sway*"
  98. "*Speed Test*"
  99. "*Dolby*"
  100. #Optional: Typically not removed but you can if you need to for some reason
  101. #"*Microsoft.Advertising.Xaml_10.1712.5.0_x64__8wekyb3d8bbwe*"
  102. #"*Microsoft.Advertising.Xaml_10.1712.5.0_x86__8wekyb3d8bbwe*"
  103. #"*Microsoft.BingWeather*"
  104. #"*Microsoft.MSPaint*"
  105. #"*Microsoft.MicrosoftStickyNotes*"
  106. #"*Microsoft.Windows.Photos*"
  107. #"*Microsoft.WindowsCalculator*"
  108. #"*Microsoft.WindowsStore*"
  109. )
  110. foreach ($Bloat in $Bloatware) {
  111. Get-AppxPackage -Name $Bloat| Remove-AppxPackage
  112. Get-AppxProvisionedPackage -Online | Where-Object DisplayName -like $Bloat | Remove-AppxProvisionedPackage -Online
  113. Write-Output "Trying to remove $Bloat."
  114. }
  115. }
  116. Function Remove-Keys {
  117. #These are the registry keys that it will delete.
  118. $Keys = @(
  119. #Remove Background Tasks
  120. "HKCR:\Extensions\ContractId\Windows.BackgroundTasks\PackageId\46928bounde.EclipseManager_2.2.4.51_neutral__a5h4egax66k6y"
  121. "HKCR:\Extensions\ContractId\Windows.BackgroundTasks\PackageId\ActiproSoftwareLLC.562882FEEB491_2.6.18.18_neutral__24pqs290vpjk0"
  122. "HKCR:\Extensions\ContractId\Windows.BackgroundTasks\PackageId\Microsoft.MicrosoftOfficeHub_17.7909.7600.0_x64__8wekyb3d8bbwe"
  123. "HKCR:\Extensions\ContractId\Windows.BackgroundTasks\PackageId\Microsoft.PPIProjection_10.0.15063.0_neutral_neutral_cw5n1h2txyewy"
  124. "HKCR:\Extensions\ContractId\Windows.BackgroundTasks\PackageId\Microsoft.XboxGameCallableUI_1000.15063.0.0_neutral_neutral_cw5n1h2txyewy"
  125. "HKCR:\Extensions\ContractId\Windows.BackgroundTasks\PackageId\Microsoft.XboxGameCallableUI_1000.16299.15.0_neutral_neutral_cw5n1h2txyewy"
  126. #Windows File
  127. "HKCR:\Extensions\ContractId\Windows.File\PackageId\ActiproSoftwareLLC.562882FEEB491_2.6.18.18_neutral__24pqs290vpjk0"
  128. #Registry keys to delete if they aren't uninstalled by RemoveAppXPackage/RemoveAppXProvisionedPackage
  129. "HKCR:\Extensions\ContractId\Windows.Launch\PackageId\46928bounde.EclipseManager_2.2.4.51_neutral__a5h4egax66k6y"
  130. "HKCR:\Extensions\ContractId\Windows.Launch\PackageId\ActiproSoftwareLLC.562882FEEB491_2.6.18.18_neutral__24pqs290vpjk0"
  131. "HKCR:\Extensions\ContractId\Windows.Launch\PackageId\Microsoft.PPIProjection_10.0.15063.0_neutral_neutral_cw5n1h2txyewy"
  132. "HKCR:\Extensions\ContractId\Windows.Launch\PackageId\Microsoft.XboxGameCallableUI_1000.15063.0.0_neutral_neutral_cw5n1h2txyewy"
  133. "HKCR:\Extensions\ContractId\Windows.Launch\PackageId\Microsoft.XboxGameCallableUI_1000.16299.15.0_neutral_neutral_cw5n1h2txyewy"
  134. #Scheduled Tasks to delete
  135. "HKCR:\Extensions\ContractId\Windows.PreInstalledConfigTask\PackageId\Microsoft.MicrosoftOfficeHub_17.7909.7600.0_x64__8wekyb3d8bbwe"
  136. #Windows Protocol Keys
  137. "HKCR:\Extensions\ContractId\Windows.Protocol\PackageId\ActiproSoftwareLLC.562882FEEB491_2.6.18.18_neutral__24pqs290vpjk0"
  138. "HKCR:\Extensions\ContractId\Windows.Protocol\PackageId\Microsoft.PPIProjection_10.0.15063.0_neutral_neutral_cw5n1h2txyewy"
  139. "HKCR:\Extensions\ContractId\Windows.Protocol\PackageId\Microsoft.XboxGameCallableUI_1000.15063.0.0_neutral_neutral_cw5n1h2txyewy"
  140. "HKCR:\Extensions\ContractId\Windows.Protocol\PackageId\Microsoft.XboxGameCallableUI_1000.16299.15.0_neutral_neutral_cw5n1h2txyewy"
  141. #Windows Share Target
  142. "HKCR:\Extensions\ContractId\Windows.ShareTarget\PackageId\ActiproSoftwareLLC.562882FEEB491_2.6.18.18_neutral__24pqs290vpjk0"
  143. )
  144. #This writes the output of each key it is removing and also removes the keys listed above.
  145. ForEach ($Key in $Keys) {
  146. Write-Output "Removing $Key from registry"
  147. Remove-Item $Key -Recurse
  148. }
  149. }
  150. Function Protect-Privacy {
  151. #Disables Windows Feedback Experience
  152. Write-Output "Disabling Windows Feedback Experience program"
  153. $Advertising = "HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\AdvertisingInfo"
  154. If (Test-Path $Advertising) {
  155. Set-ItemProperty $Advertising Enabled -Value 0
  156. }
  157. #Stops Cortana from being used as part of your Windows Search Function
  158. Write-Output "Stopping Cortana from being used as part of your Windows Search Function"
  159. $Search = "HKLM:\SOFTWARE\Policies\Microsoft\Windows\Windows Search"
  160. If (Test-Path $Search) {
  161. Set-ItemProperty $Search AllowCortana -Value 0
  162. }
  163. #Disables Web Search in Start Menu
  164. Write-Output "Disabling Bing Search in Start Menu"
  165. $WebSearch = "HKLM:\SOFTWARE\Policies\Microsoft\Windows\Windows Search"
  166. Set-ItemProperty "HKCU:\SOFTWARE\Microsoft\Windows\CurrentVersion\Search" BingSearchEnabled -Value 0
  167. If (!(Test-Path $WebSearch)) {
  168. New-Item $WebSearch
  169. }
  170. Set-ItemProperty $WebSearch DisableWebSearch -Value 1
  171. #Stops the Windows Feedback Experience from sending anonymous data
  172. Write-Output "Stopping the Windows Feedback Experience program"
  173. $Period = "HKCU:\Software\Microsoft\Siuf\Rules"
  174. If (!(Test-Path $Period)) {
  175. New-Item $Period
  176. }
  177. Set-ItemProperty $Period PeriodInNanoSeconds -Value 0
  178. #Prevents bloatware applications from returning and removes Start Menu suggestions
  179. Write-Output "Adding Registry key to prevent bloatware apps from returning"
  180. $registryPath = "HKLM:\SOFTWARE\Policies\Microsoft\Windows\CloudContent"
  181. $registryOEM = "HKCU:\SOFTWARE\Microsoft\Windows\CurrentVersion\ContentDeliveryManager"
  182. If (!(Test-Path $registryPath)) {
  183. New-Item $registryPath
  184. }
  185. Set-ItemProperty $registryPath DisableWindowsConsumerFeatures -Value 1
  186. If (!(Test-Path $registryOEM)) {
  187. New-Item $registryOEM
  188. }
  189. Set-ItemProperty $registryOEM ContentDeliveryAllowed -Value 0
  190. Set-ItemProperty $registryOEM OemPreInstalledAppsEnabled -Value 0
  191. Set-ItemProperty $registryOEM PreInstalledAppsEnabled -Value 0
  192. Set-ItemProperty $registryOEM PreInstalledAppsEverEnabled -Value 0
  193. Set-ItemProperty $registryOEM SilentInstalledAppsEnabled -Value 0
  194. Set-ItemProperty $registryOEM SystemPaneSuggestionsEnabled -Value 0
  195. #Preping mixed Reality Portal for removal
  196. Write-Output "Setting Mixed Reality Portal value to 0 so that you can uninstall it in Settings"
  197. $Holo = "HKCU:\Software\Microsoft\Windows\CurrentVersion\Holographic"
  198. If (Test-Path $Holo) {
  199. Set-ItemProperty $Holo FirstRunSucceeded -Value 0
  200. }
  201. #Disables Wi-fi Sense
  202. Write-Output "Disabling Wi-Fi Sense"
  203. $WifiSense1 = "HKLM:\SOFTWARE\Microsoft\PolicyManager\default\WiFi\AllowWiFiHotSpotReporting"
  204. $WifiSense2 = "HKLM:\SOFTWARE\Microsoft\PolicyManager\default\WiFi\AllowAutoConnectToWiFiSenseHotspots"
  205. $WifiSense3 = "HKLM:\SOFTWARE\Microsoft\WcmSvc\wifinetworkmanager\config"
  206. If (!(Test-Path $WifiSense1)) {
  207. New-Item $WifiSense1
  208. }
  209. Set-ItemProperty $WifiSense1 Value -Value 0
  210. If (!(Test-Path $WifiSense2)) {
  211. New-Item $WifiSense2
  212. }
  213. Set-ItemProperty $WifiSense2 Value -Value 0
  214. Set-ItemProperty $WifiSense3 AutoConnectAllowedOEM -Value 0
  215. #Disables live tiles
  216. Write-Output "Disabling live tiles"
  217. $Live = "HKCU:\SOFTWARE\Policies\Microsoft\Windows\CurrentVersion\PushNotifications"
  218. If (!(Test-Path $Live)) {
  219. New-Item $Live
  220. }
  221. Set-ItemProperty $Live NoTileApplicationNotification -Value 1
  222. #Turns off Data Collection via the AllowTelemtry key by changing it to 0
  223. Write-Output "Turning off Data Collection"
  224. $DataCollection1 = "HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\Policies\DataCollection"
  225. $DataCollection2 = "HKLM:\SOFTWARE\Policies\Microsoft\Windows\DataCollection"
  226. $DataCollection3 = "HKLM:\SOFTWARE\Wow6432Node\Microsoft\Windows\CurrentVersion\Policies\DataCollection"
  227. If (Test-Path $DataCollection1) {
  228. Set-ItemProperty $DataCollection1 AllowTelemetry -Value 0
  229. }
  230. If (Test-Path $DataCollection2) {
  231. Set-ItemProperty $DataCollection2 AllowTelemetry -Value 0
  232. }
  233. If (Test-Path $DataCollection3) {
  234. Set-ItemProperty $DataCollection3 AllowTelemetry -Value 0
  235. }
  236. #Disabling Location Tracking
  237. Write-Output "Disabling Location Tracking"
  238. $SensorState = "HKLM:\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Sensor\Overrides\{BFA794E4-F964-4FDB-90F6-51056BFE4B44}"
  239. $LocationConfig = "HKLM:\SYSTEM\CurrentControlSet\Services\lfsvc\Service\Configuration"
  240. If (!(Test-Path $SensorState)) {
  241. New-Item $SensorState
  242. }
  243. Set-ItemProperty $SensorState SensorPermissionState -Value 0
  244. If (!(Test-Path $LocationConfig)) {
  245. New-Item $LocationConfig
  246. }
  247. Set-ItemProperty $LocationConfig Status -Value 0
  248. #Disables People icon on Taskbar
  249. Write-Output "Disabling People icon on Taskbar"
  250. $People = 'HKCU:\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\Advanced\People'
  251. If (Test-Path $People) {
  252. Set-ItemProperty $People -Name PeopleBand -Value 0
  253. }
  254. #Disables scheduled tasks that are considered unnecessary
  255. Write-Output "Disabling scheduled tasks"
  256. Get-ScheduledTask XblGameSaveTaskLogon | Disable-ScheduledTask
  257. Get-ScheduledTask XblGameSaveTask | Disable-ScheduledTask
  258. Get-ScheduledTask Consolidator | Disable-ScheduledTask
  259. Get-ScheduledTask UsbCeip | Disable-ScheduledTask
  260. Get-ScheduledTask DmClient | Disable-ScheduledTask
  261. Get-ScheduledTask DmClientOnScenarioDownload | Disable-ScheduledTask
  262. Write-Output "Stopping and disabling Diagnostics Tracking Service"
  263. #Disabling the Diagnostics Tracking Service
  264. Stop-Service "DiagTrack"
  265. Set-Service "DiagTrack" -StartupType Disabled
  266. Write-Output "Removing CloudStore from registry if it exists"
  267. $CloudStore = 'HKCU:\Software\Microsoft\Windows\CurrentVersion\CloudStore'
  268. If (Test-Path $CloudStore) {
  269. Stop-Process Explorer.exe -Force
  270. Remove-Item $CloudStore -Recurse -Force
  271. Start-Process Explorer.exe -Wait
  272. }
  273. }
  274. Function DisableCortana {
  275. Write-Host "Disabling Cortana"
  276. $Cortana1 = "HKCU:\SOFTWARE\Microsoft\Personalization\Settings"
  277. $Cortana2 = "HKCU:\SOFTWARE\Microsoft\InputPersonalization"
  278. $Cortana3 = "HKCU:\SOFTWARE\Microsoft\InputPersonalization\TrainedDataStore"
  279. If (!(Test-Path $Cortana1)) {
  280. New-Item $Cortana1
  281. }
  282. Set-ItemProperty $Cortana1 AcceptedPrivacyPolicy -Value 0
  283. If (!(Test-Path $Cortana2)) {
  284. New-Item $Cortana2
  285. }
  286. Set-ItemProperty $Cortana2 RestrictImplicitTextCollection -Value 1
  287. Set-ItemProperty $Cortana2 RestrictImplicitInkCollection -Value 1
  288. If (!(Test-Path $Cortana3)) {
  289. New-Item $Cortana3
  290. }
  291. Set-ItemProperty $Cortana3 HarvestContacts -Value 0
  292. }
  293. Function EnableCortana {
  294. Write-Host "Re-enabling Cortana"
  295. $Cortana1 = "HKCU:\SOFTWARE\Microsoft\Personalization\Settings"
  296. $Cortana2 = "HKCU:\SOFTWARE\Microsoft\InputPersonalization"
  297. $Cortana3 = "HKCU:\SOFTWARE\Microsoft\InputPersonalization\TrainedDataStore"
  298. If (!(Test-Path $Cortana1)) {
  299. New-Item $Cortana1
  300. }
  301. Set-ItemProperty $Cortana1 AcceptedPrivacyPolicy -Value 1
  302. If (!(Test-Path $Cortana2)) {
  303. New-Item $Cortana2
  304. }
  305. Set-ItemProperty $Cortana2 RestrictImplicitTextCollection -Value 0
  306. Set-ItemProperty $Cortana2 RestrictImplicitInkCollection -Value 0
  307. If (!(Test-Path $Cortana3)) {
  308. New-Item $Cortana3
  309. }
  310. Set-ItemProperty $Cortana3 HarvestContacts -Value 1
  311. }
  312. Function Stop-EdgePDF {
  313. #Stops edge from taking over as the default .PDF viewer
  314. Write-Output "Stopping Edge from taking over as the default .PDF viewer"
  315. $NoPDF = "HKCR:\.pdf"
  316. $NoProgids = "HKCR:\.pdf\OpenWithProgids"
  317. $NoWithList = "HKCR:\.pdf\OpenWithList"
  318. If (!(Get-ItemProperty $NoPDF NoOpenWith)) {
  319. New-ItemProperty $NoPDF NoOpenWith
  320. }
  321. If (!(Get-ItemProperty $NoPDF NoStaticDefaultVerb)) {
  322. New-ItemProperty $NoPDF NoStaticDefaultVerb
  323. }
  324. If (!(Get-ItemProperty $NoProgids NoOpenWith)) {
  325. New-ItemProperty $NoProgids NoOpenWith
  326. }
  327. If (!(Get-ItemProperty $NoProgids NoStaticDefaultVerb)) {
  328. New-ItemProperty $NoProgids NoStaticDefaultVerb
  329. }
  330. If (!(Get-ItemProperty $NoWithList NoOpenWith)) {
  331. New-ItemProperty $NoWithList NoOpenWith
  332. }
  333. If (!(Get-ItemProperty $NoWithList NoStaticDefaultVerb)) {
  334. New-ItemProperty $NoWithList NoStaticDefaultVerb
  335. }
  336. #Appends an underscore '_' to the Registry key for Edge
  337. $Edge = "HKCR:\AppXd4nrz8ff68srnhf9t5a8sbjyar1cr723_"
  338. If (Test-Path $Edge) {
  339. Set-Item $Edge AppXd4nrz8ff68srnhf9t5a8sbjyar1cr723_
  340. }
  341. }
  342. Function Revert-Changes {
  343. #This function will revert the changes you made when running the Start-Debloat function.
  344. #This line reinstalls all of the bloatware that was removed
  345. Get-AppxPackage -AllUsers | ForEach {Add-AppxPackage -Verbose -DisableDevelopmentMode -Register "$($_.InstallLocation)\AppXManifest.xml"}
  346. #Tells Windows to enable your advertising information.
  347. Write-Output "Re-enabling key to show advertisement information"
  348. $Advertising = "HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\AdvertisingInfo"
  349. If (Test-Path $Advertising) {
  350. Set-ItemProperty $Advertising Enabled -Value 1
  351. }
  352. #Enables Cortana to be used as part of your Windows Search Function
  353. Write-Output "Re-enabling Cortana to be used in your Windows Search"
  354. $Search = "HKLM:\SOFTWARE\Policies\Microsoft\Windows\Windows Search"
  355. If (Test-Path $Search) {
  356. Set-ItemProperty $Search AllowCortana -Value 1
  357. }
  358. #Re-enables the Windows Feedback Experience for sending anonymous data
  359. Write-Output "Re-enabling Windows Feedback Experience"
  360. $Period = "HKCU:\Software\Microsoft\Siuf\Rules"
  361. If (!(Test-Path $Period)) {
  362. New-Item $Period
  363. }
  364. Set-ItemProperty $Period PeriodInNanoSeconds -Value 1
  365. #Enables bloatware applications
  366. Write-Output "Adding Registry key to allow bloatware apps to return"
  367. $registryPath = "HKLM:\SOFTWARE\Policies\Microsoft\Windows\CloudContent"
  368. If (!(Test-Path $registryPath)) {
  369. New-Item $registryPath
  370. }
  371. Set-ItemProperty $registryPath DisableWindowsConsumerFeatures -Value 0
  372. #Changes Mixed Reality Portal Key 'FirstRunSucceeded' to 1
  373. Write-Output "Setting Mixed Reality Portal value to 1"
  374. $Holo = "HKCU:\Software\Microsoft\Windows\CurrentVersion\Holographic"
  375. If (Test-Path $Holo) {
  376. Set-ItemProperty $Holo FirstRunSucceeded -Value 1
  377. }
  378. #Re-enables live tiles
  379. Write-Output "Enabling live tiles"
  380. $Live = "HKCU:\SOFTWARE\Policies\Microsoft\Windows\CurrentVersion\PushNotifications"
  381. If (!(Test-Path $Live)) {
  382. New-Item $Live
  383. }
  384. Set-ItemProperty $Live NoTileApplicationNotification -Value 0
  385. #Re-enables data collection
  386. Write-Output "Re-enabling data collection"
  387. $DataCollection = "HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\Policies\DataCollection"
  388. If (!(Test-Path $DataCollection)) {
  389. New-Item $DataCollection
  390. }
  391. Set-ItemProperty $DataCollection AllowTelemetry -Value 1
  392. #Re-enables People Icon on Taskbar
  393. Write-Output "Enabling People icon on Taskbar"
  394. $People = "HKCU:\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\Advanced\People"
  395. If (!(Test-Path $People)) {
  396. New-Item $People
  397. }
  398. Set-ItemProperty $People PeopleBand -Value 1
  399. #Re-enables suggestions on start menu
  400. Write-Output "Enabling suggestions on the Start Menu"
  401. $Suggestions = "HKCU:\Software\Microsoft\Windows\CurrentVersion\ContentDeliveryManager"
  402. If (!(Test-Path $Suggestions)) {
  403. New-Item $Suggestions
  404. }
  405. Set-ItemProperty $Suggestions SystemPaneSuggestionsEnabled -Value 1
  406. #Re-enables scheduled tasks that were disabled when running the Debloat switch
  407. Write-Output "Enabling scheduled tasks that were disabled"
  408. Get-ScheduledTask XblGameSaveTaskLogon | Enable-ScheduledTask
  409. Get-ScheduledTask XblGameSaveTask | Enable-ScheduledTask
  410. Get-ScheduledTask Consolidator | Enable-ScheduledTask
  411. Get-ScheduledTask UsbCeip | Enable-ScheduledTask
  412. Get-ScheduledTask DmClient | Enable-ScheduledTask
  413. Get-ScheduledTask DmClientOnScenarioDownload | Enable-ScheduledTask
  414. Write-Output "Re-enabling and starting WAP Push Service"
  415. #Enable and start WAP Push Service
  416. Set-Service "dmwappushservice" -StartupType Automatic
  417. Start-Service "dmwappushservice"
  418. Write-Output "Re-enabling and starting the Diagnostics Tracking Service"
  419. #Enabling the Diagnostics Tracking Service
  420. Set-Service "DiagTrack" -StartupType Automatic
  421. Start-Service "DiagTrack"
  422. Write-Output "Restoring 3D Objects in the 'My Computer' submenu in explorer"
  423. #Restoring 3D Objects in the 'My Computer' submenu in explorer
  424. Restore3dObjects
  425. }
  426. Function CheckDMWService {
  427. Param([switch]$Debloat)
  428. If (Get-Service -Name dmwappushservice | Where-Object {$_.StartType -eq "Disabled"}) {
  429. Set-Service -Name dmwappushservice -StartupType Automatic
  430. }
  431. If (Get-Service -Name dmwappushservice | Where-Object {$_.Status -eq "Stopped"}) {
  432. Start-Service -Name dmwappushservice
  433. }
  434. }
  435. Function Enable-EdgePDF {
  436. Write-Output "Setting Edge back to default"
  437. $NoPDF = "HKCR:\.pdf"
  438. $NoProgids = "HKCR:\.pdf\OpenWithProgids"
  439. $NoWithList = "HKCR:\.pdf\OpenWithList"
  440. #Sets edge back to default
  441. If (Get-ItemProperty $NoPDF NoOpenWith) {
  442. Remove-ItemProperty $NoPDF NoOpenWith
  443. }
  444. If (Get-ItemProperty $NoPDF NoStaticDefaultVerb) {
  445. Remove-ItemProperty $NoPDF NoStaticDefaultVerb
  446. }
  447. If (Get-ItemProperty $NoProgids NoOpenWith) {
  448. Remove-ItemProperty $NoProgids NoOpenWith
  449. }
  450. If (Get-ItemProperty $NoProgids NoStaticDefaultVerb) {
  451. Remove-ItemProperty $NoProgids NoStaticDefaultVerb
  452. }
  453. If (Get-ItemProperty $NoWithList NoOpenWith) {
  454. Remove-ItemProperty $NoWithList NoOpenWith
  455. }
  456. If (Get-ItemProperty $NoWithList NoStaticDefaultVerb) {
  457. Remove-ItemProperty $NoWithList NoStaticDefaultVerb
  458. }
  459. #Removes an underscore '_' from the Registry key for Edge
  460. $Edge2 = "HKCR:\AppXd4nrz8ff68srnhf9t5a8sbjyar1cr723_"
  461. If (Test-Path $Edge2) {
  462. Set-Item $Edge2 AppXd4nrz8ff68srnhf9t5a8sbjyar1cr723
  463. }
  464. }
  465. Function FixWhitelistedApps {
  466. If (!(Get-AppxPackage -AllUsers | Select Microsoft.Paint3D, Microsoft.WindowsCalculator, Microsoft.WindowsStore, Microsoft.Windows.Photos)) {
  467. #Credit to abulgatz for these 4 lines of code
  468. Get-AppxPackage -allusers Microsoft.Paint3D | Foreach {Add-AppxPackage -DisableDevelopmentMode -Register "$($_.InstallLocation)\AppXManifest.xml"}
  469. Get-AppxPackage -allusers Microsoft.WindowsCalculator | Foreach {Add-AppxPackage -DisableDevelopmentMode -Register "$($_.InstallLocation)\AppXManifest.xml"}
  470. Get-AppxPackage -allusers Microsoft.WindowsStore | Foreach {Add-AppxPackage -DisableDevelopmentMode -Register "$($_.InstallLocation)\AppXManifest.xml"}
  471. Get-AppxPackage -allusers Microsoft.Windows.Photos | Foreach {Add-AppxPackage -DisableDevelopmentMode -Register "$($_.InstallLocation)\AppXManifest.xml"}
  472. }
  473. }
  474. Function UninstallOneDrive {
  475. Write-Host "Checking for pre-existing files and folders located in the OneDrive folders..."
  476. Start-Sleep 1
  477. If (Test-Path "$env:USERPROFILE\OneDrive\*") {
  478. Write-Host "Files found within the OneDrive folder! Checking to see if a folder named OneDriveBackupFiles exists."
  479. Start-Sleep 1
  480. If (Test-Path "$env:USERPROFILE\Desktop\OneDriveBackupFiles") {
  481. Write-Host "A folder named OneDriveBackupFiles already exists on your desktop. All files from your OneDrive location will be moved to that folder."
  482. }
  483. else {
  484. If (!(Test-Path "$env:USERPROFILE\Desktop\OneDriveBackupFiles")) {
  485. Write-Host "A folder named OneDriveBackupFiles will be created and will be located on your desktop. All files from your OneDrive location will be located in that folder."
  486. New-item -Path "$env:USERPROFILE\Desktop" -Name "OneDriveBackupFiles"-ItemType Directory -Force
  487. Write-Host "Successfully created the folder 'OneDriveBackupFiles' on your desktop."
  488. }
  489. }
  490. Start-Sleep 1
  491. Move-Item -Path "$env:USERPROFILE\OneDrive\*" -Destination "$env:USERPROFILE\Desktop\OneDriveBackupFiles" -Force
  492. Write-Host "Successfully moved all files/folders from your OneDrive folder to the folder 'OneDriveBackupFiles' on your desktop."
  493. Start-Sleep 1
  494. Write-Host "Proceeding with the removal of OneDrive."
  495. Start-Sleep 1
  496. }
  497. Else {
  498. Write-Host "Either the OneDrive folder does not exist or there are no files to be found in the folder. Proceeding with removal of OneDrive."
  499. Start-Sleep 1
  500. Write-Host "Enabling the Group Policy 'Prevent the usage of OneDrive for File Storage'."
  501. $OneDriveKey = 'HKLM:Software\Policies\Microsoft\Windows\OneDrive'
  502. If (!(Test-Path $OneDriveKey)) {
  503. Mkdir $OneDriveKey
  504. Set-ItemProperty $OneDriveKey -Name OneDrive -Value DisableFileSyncNGSC
  505. }
  506. Set-ItemProperty $OneDriveKey -Name OneDrive -Value DisableFileSyncNGSC
  507. }
  508. Write-Host "Uninstalling OneDrive. Please wait..."
  509. New-PSDrive HKCR -PSProvider Registry -Root HKEY_CLASSES_ROOT
  510. $onedrive = "$env:SYSTEMROOT\SysWOW64\OneDriveSetup.exe"
  511. $ExplorerReg1 = "HKCR:\CLSID\{018D5C66-4533-4307-9B53-224DE2ED1FE6}"
  512. $ExplorerReg2 = "HKCR:\Wow6432Node\CLSID\{018D5C66-4533-4307-9B53-224DE2ED1FE6}"
  513. Stop-Process -Name "OneDrive*"
  514. Start-Sleep 2
  515. If (!(Test-Path $onedrive)) {
  516. $onedrive = "$env:SYSTEMROOT\System32\OneDriveSetup.exe"
  517. New-PSDrive HKCR -PSProvider Registry -Root HKEY_CLASSES_ROOT
  518. $onedrive = "$env:SYSTEMROOT\SysWOW64\OneDriveSetup.exe"
  519. $ExplorerReg1 = "HKCR:\CLSID\{018D5C66-4533-4307-9B53-224DE2ED1FE6}"
  520. $ExplorerReg2 = "HKCR:\Wow6432Node\CLSID\{018D5C66-4533-4307-9B53-224DE2ED1FE6}"
  521. Stop-Process -Name "OneDrive*"
  522. Start-Sleep 2
  523. If (!(Test-Path $onedrive)) {
  524. $onedrive = "$env:SYSTEMROOT\System32\OneDriveSetup.exe"
  525. }
  526. Start-Process $onedrive "/uninstall" -NoNewWindow -Wait
  527. Start-Sleep 2
  528. Write-Output "Stopping explorer"
  529. Start-Sleep 1
  530. taskkill.exe /F /IM explorer.exe
  531. Start-Sleep 3
  532. Write-Output "Removing leftover files"
  533. Remove-Item "$env:USERPROFILE\OneDrive" -Force -Recurse
  534. Remove-Item "$env:LOCALAPPDATA\Microsoft\OneDrive" -Force -Recurse
  535. Remove-Item "$env:PROGRAMDATA\Microsoft OneDrive" -Force -Recurse
  536. If (Test-Path "$env:SYSTEMDRIVE\OneDriveTemp") {
  537. Remove-Item "$env:SYSTEMDRIVE\OneDriveTemp" -Force -Recurse
  538. }
  539. Write-Output "Removing OneDrive from windows explorer"
  540. If (!(Test-Path $ExplorerReg1)) {
  541. New-Item $ExplorerReg1
  542. }
  543. Set-ItemProperty $ExplorerReg1 System.IsPinnedToNameSpaceTree -Value 0
  544. If (!(Test-Path $ExplorerReg2)) {
  545. New-Item $ExplorerReg2
  546. }
  547. Set-ItemProperty $ExplorerReg2 System.IsPinnedToNameSpaceTree -Value 0
  548. Write-Output "Restarting Explorer that was shut down before."
  549. Start-Process explorer.exe -NoNewWindow
  550. Write-Host "Enabling the Group Policy 'Prevent the usage of OneDrive for File Storage'."
  551. $OneDriveKey = 'HKLM:Software\Policies\Microsoft\Windows\OneDrive'
  552. If (!(Test-Path $OneDriveKey)) {
  553. Mkdir $OneDriveKey
  554. }
  555. Start-Process $onedrive "/uninstall" -NoNewWindow -Wait
  556. Start-Sleep 2
  557. Write-Host "Stopping explorer"
  558. Start-Sleep 1
  559. taskkill.exe /F /IM explorer.exe
  560. Start-Sleep 3
  561. Write-Host "Removing leftover files"
  562. If (Test-Path "$env:USERPROFILE\OneDrive") {
  563. Remove-Item "$env:USERPROFILE\OneDrive" -Force -Recurse
  564. }
  565. If (Test-Path "$env:LOCALAPPDATA\Microsoft\OneDrive") {
  566. Remove-Item "$env:LOCALAPPDATA\Microsoft\OneDrive" -Force -Recurse
  567. }
  568. If (Test-Path "$env:PROGRAMDATA\Microsoft OneDrive") {
  569. Remove-Item "$env:PROGRAMDATA\Microsoft OneDrive" -Force -Recurse
  570. }
  571. If (Test-Path "$env:SYSTEMDRIVE\OneDriveTemp") {
  572. Remove-Item "$env:SYSTEMDRIVE\OneDriveTemp" -Force -Recurse
  573. }
  574. Write-Host "Removing OneDrive from windows explorer"
  575. If (!(Test-Path $ExplorerReg1)) {
  576. New-Item $ExplorerReg1
  577. }
  578. Set-ItemProperty $ExplorerReg1 System.IsPinnedToNameSpaceTree -Value 0
  579. If (!(Test-Path $ExplorerReg2)) {
  580. New-Item $ExplorerReg2
  581. }
  582. Set-ItemProperty $ExplorerReg2 System.IsPinnedToNameSpaceTree -Value 0
  583. Write-Host "Restarting Explorer that was shut down before."
  584. Start-Process explorer.exe -NoNewWindow
  585. Write-Host "OneDrive has been successfully uninstalled!"
  586. Remove-item env:OneDrive
  587. }
  588. }
  589. Function UnpinStart {
  590. #https://superuser.com/questions/1068382/how-to-remove-all-the-tiles-in-the-windows-10-start-menu
  591. #Unpins all tiles from the Start Menu
  592. Write-Host "Unpinning all tiles from the start menu"
  593. (New-Object -Com Shell.Application).
  594. NameSpace('shell:::{4234d49b-0245-4df3-b780-3893943456e1}').
  595. Items() |
  596. % { $_.Verbs() } |
  597. ? {$_.Name -match 'Un.*pin from Start'} |
  598. % {$_.DoIt()}
  599. }
  600. Function Remove3dObjects {
  601. #Removes 3D Objects from the 'My Computer' submenu in explorer
  602. Write-Host "Removing 3D Objects from explorer 'My Computer' submenu"
  603. $Objects32 = "HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\MyComputer\NameSpace\{0DB7E03F-FC29-4DC6-9020-FF41B59E513A}"
  604. $Objects64 = "HKLM:\SOFTWARE\WOW6432Node\Microsoft\Windows\CurrentVersion\Explorer\MyComputer\NameSpace\{0DB7E03F-FC29-4DC6-9020-FF41B59E513A}"
  605. If (Test-Path $Objects32) {
  606. Remove-Item $Objects32 -Recurse
  607. }
  608. If (Test-Path $Objects64) {
  609. Remove-Item $Objects64 -Recurse
  610. }
  611. }
  612. Function Restore3dObjects {
  613. #Restores 3D Objects from the 'My Computer' submenu in explorer
  614. Write-Host "Restoring 3D Objects from explorer 'My Computer' submenu"
  615. $Objects32 = "HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\MyComputer\NameSpace\{0DB7E03F-FC29-4DC6-9020-FF41B59E513A}"
  616. $Objects64 = "HKLM:\SOFTWARE\WOW6432Node\Microsoft\Windows\CurrentVersion\Explorer\MyComputer\NameSpace\{0DB7E03F-FC29-4DC6-9020-FF41B59E513A}"
  617. If (!(Test-Path $Objects32)) {
  618. New-Item $Objects32
  619. }
  620. If (!(Test-Path $Objects64)) {
  621. New-Item $Objects64
  622. }
  623. }
  624. #Interactive prompt Debloat/Revert options
  625. $Button = [Windows.MessageBoxButton]::YesNoCancel
  626. $ErrorIco = [Windows.MessageBoxImage]::Error
  627. $Warn = [Windows.MessageBoxImage]::Warning
  628. $Ask = 'The following will allow you to either Debloat Windows 10 or to revert changes made after Debloating Windows 10.
  629. Select "Yes" to Debloat Windows 10
  630. Select "No" to Revert changes made by this script
  631. Select "Cancel" to stop the script.'
  632. $EverythingorSpecific = "Would you like to remove everything that was preinstalled on your Windows Machine? Select Yes to remove everything, or select No to remove apps via a blacklist."
  633. $EdgePdf = "Do you want to stop edge from taking over as the default PDF viewer?"
  634. $EdgePdf2 = "Do you want to revert changes that disabled Edge as the default PDF viewer?"
  635. $Reboot = "For some of the changes to properly take effect it is recommended to reboot your machine. Would you like to restart?"
  636. $OneDriveDelete = "Do you want to uninstall One Drive?"
  637. $Unpin = "Do you want to unpin all items from the Start menu?"
  638. $InstallNET = "Do you want to install .NET 3.5?"
  639. $Prompt1 = [Windows.MessageBox]::Show($Ask, "Debloat or Revert", $Button, $ErrorIco)
  640. Switch ($Prompt1) {
  641. #This will debloat Windows 10
  642. Yes {
  643. #Everything is specific prompt
  644. $Prompt2 = [Windows.MessageBox]::Show($EverythingorSpecific, "Everything or Specific", $Button, $Warn)
  645. switch ($Prompt2) {
  646. Yes {
  647. #Creates a "drive" to access the HKCR (HKEY_CLASSES_ROOT)
  648. Write-Host "Creating PSDrive 'HKCR' (HKEY_CLASSES_ROOT). This will be used for the duration of the script as it is necessary for the removal and modification of specific registry keys."
  649. New-PSDrive HKCR -PSProvider Registry -Root HKEY_CLASSES_ROOT
  650. Start-Sleep 1
  651. Write-Host "Uninstalling bloatware, please wait."
  652. DebloatAll
  653. Write-Host "Bloatware removed."
  654. Start-Sleep 1
  655. Write-Host "Removing specific registry keys."
  656. Remove-Keys
  657. Write-Host "Leftover bloatware registry keys removed."
  658. Start-Sleep 1
  659. Write-Host "Checking to see if any Whitelisted Apps were removed, and if so re-adding them."
  660. Start-Sleep 1
  661. FixWhitelistedApps
  662. Start-Sleep 1
  663. Write-Host "Disabling Cortana from search, disabling feedback to Microsoft, and disabling scheduled tasks that are considered to be telemetry or unnecessary."
  664. Protect-Privacy
  665. Start-Sleep 1
  666. DisableCortana
  667. Write-Host "Cortana disabled and removed from search, feedback to Microsoft has been disabled, and scheduled tasks are disabled."
  668. Start-Sleep 1
  669. Write-Host "Stopping and disabling Diagnostics Tracking Service"
  670. DisableDiagTrack
  671. Write-Host "Diagnostics Tracking Service disabled"
  672. Start-Sleep 1
  673. Write-Host "Disabling WAP push service"
  674. DisableWAPPush
  675. Start-Sleep 1
  676. Write-Host "Re-enabling DMWAppushservice if it was disabled"
  677. CheckDMWService
  678. Start-Sleep 1
  679. Write-Host "Removing 3D Objects from the 'My Computer' submenu in explorer"
  680. Remove3dObjects
  681. Start-Sleep 1
  682. }
  683. No {
  684. #Creates a "drive" to access the HKCR (HKEY_CLASSES_ROOT)
  685. Write-Host "Creating PSDrive 'HKCR' (HKEY_CLASSES_ROOT). This will be used for the duration of the script as it is necessary for the removal and modification of specific registry keys."
  686. New-PSDrive HKCR -PSProvider Registry -Root HKEY_CLASSES_ROOT
  687. Start-Sleep 1
  688. Write-Host "Uninstalling bloatware, please wait."
  689. DebloatBlacklist
  690. Write-Host "Bloatware removed."
  691. Start-Sleep 1
  692. Write-Host "Removing specific registry keys."
  693. Remove-Keys
  694. Write-Host "Leftover bloatware registry keys removed."
  695. Start-Sleep 1
  696. Write-Host "Checking to see if any Whitelisted Apps were removed, and if so re-adding them."
  697. Start-Sleep 1
  698. FixWhitelistedApps
  699. Start-Sleep 1
  700. Write-Host "Disabling Cortana from search, disabling feedback to Microsoft, and disabling scheduled tasks that are considered to be telemetry or unnecessary."
  701. Protect-Privacy
  702. Start-Sleep 1
  703. DisableCortana
  704. Write-Host "Cortana disabled and removed from search, feedback to Microsoft has been disabled, and scheduled tasks are disabled."
  705. Start-Sleep 1
  706. Write-Host "Stopping and disabling Diagnostics Tracking Service"
  707. DisableDiagTrack
  708. Write-Host "Diagnostics Tracking Service disabled"
  709. Start-Sleep 1
  710. Write-Host "Disabling WAP push service"
  711. Start-Sleep 1
  712. DisableWAPPush
  713. Write-Host "Re-enabling DMWAppushservice if it was disabled"
  714. CheckDMWService
  715. Start-Sleep 1
  716. }
  717. }
  718. #Disabling EdgePDF prompt
  719. $Prompt3 = [Windows.MessageBox]::Show($EdgePdf, "Edge PDF", $Button, $Warn)
  720. Switch ($Prompt3) {
  721. Yes {
  722. Stop-EdgePDF
  723. Write-Host "Edge will no longer take over as the default PDF viewer."
  724. }
  725. No {
  726. Write-Host "You chose not to stop Edge from taking over as the default PDF viewer."
  727. }
  728. }
  729. #Prompt asking to delete OneDrive
  730. $Prompt4 = [Windows.MessageBox]::Show($OneDriveDelete, "Delete OneDrive", $Button, $ErrorIco)
  731. Switch ($Prompt4) {
  732. Yes {
  733. UninstallOneDrive
  734. Write-Host "OneDrive is now removed from the computer."
  735. }
  736. No {
  737. Write-Host "You have chosen to skip removing OneDrive from your machine."
  738. }
  739. }
  740. #Prompt asking if you'd like to unpin all start items
  741. $Prompt5 = [Windows.MessageBox]::Show($Unpin, "Unpin", $Button, $ErrorIco)
  742. Switch ($Prompt5) {
  743. Yes {
  744. UnpinStart
  745. Write-Host "Start Apps unpined."
  746. }
  747. No {
  748. Write-Host "Apps will remain pinned to the start menu."
  749. }
  750. }
  751. #Prompt asking if you want to install .NET
  752. $Prompt6 = [Windows.MessageBox]::Show($InstallNET, "Install .Net", $Button, $Warn)
  753. Switch ($Prompt6) {
  754. Yes {
  755. Write-Host "Initializing the installation of .NET 3.5..."
  756. DISM /Online /Enable-Feature /FeatureName:NetFx3 /All
  757. Write-Host ".NET 3.5 has been successfully installed!"
  758. }
  759. No {
  760. Write-Host "Skipping .NET install."
  761. }
  762. }
  763. #Prompt asking if you'd like to reboot your machine
  764. $Prompt7 = [Windows.MessageBox]::Show($Reboot, "Reboot", $Button, $Warn)
  765. Switch ($Prompt7) {
  766. Yes {
  767. Write-Host "Unloading the HKCR drive..."
  768. Remove-PSDrive HKCR
  769. Start-Sleep 1
  770. Write-Host "Initiating reboot."
  771. Stop-Transcript
  772. Start-Sleep 2
  773. Restart-Computer
  774. }
  775. No {
  776. Write-Host "Unloading the HKCR drive..."
  777. Remove-PSDrive HKCR
  778. Start-Sleep 1
  779. Write-Host "Script has finished. Exiting."
  780. Stop-Transcript
  781. Start-Sleep 2
  782. Exit
  783. }
  784. }
  785. }
  786. No {
  787. Write-Host "Reverting changes..."
  788. Write-Host "Creating PSDrive 'HKCR' (HKEY_CLASSES_ROOT). This will be used for the duration of the script as it is necessary for the modification of specific registry keys."
  789. New-PSDrive HKCR -PSProvider Registry -Root HKEY_CLASSES_ROOT
  790. Revert-Changes
  791. #Prompt asking to revert edge changes as well
  792. $Prompt6 = [Windows.MessageBox]::Show($EdgePdf2, "Revert Edge", $Button, $ErrorIco)
  793. Switch ($Prompt6) {
  794. Yes {
  795. Enable-EdgePDF
  796. Write-Host "Edge will no longer be disabled from being used as the default Edge PDF viewer."
  797. }
  798. No {
  799. Write-Host "You have chosen to keep the setting that disallows Edge to be the default PDF viewer."
  800. }
  801. }
  802. #Prompt asking if you'd like to reboot your machine
  803. $Prompt7 = [Windows.MessageBox]::Show($Reboot, "Reboot", $Button, $Warn)
  804. Switch ($Prompt7) {
  805. Yes {
  806. Write-Host "Unloading the HKCR drive..."
  807. Remove-PSDrive HKCR
  808. Start-Sleep 1
  809. Write-Host "Initiating reboot."
  810. Stop-Transcript
  811. Start-Sleep 2
  812. Restart-Computer
  813. }
  814. No {
  815. Write-Host "Unloading the HKCR drive..."
  816. Remove-PSDrive HKCR
  817. Start-Sleep 1
  818. Write-Host "Script has finished. Exiting."
  819. Stop-Transcript
  820. Start-Sleep 2
  821. Exit
  822. }
  823. }
  824. }
  825. }