Windows10Debloater.ps1 45 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986
  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. "*BubbleWitch3Saga*"
  91. "*Wunderlist*"
  92. "*Flipboard*"
  93. "*Twitter*"
  94. "*Facebook*"
  95. "*Spotify*"
  96. "*Minecraft*"
  97. "*Royal Revolt*"
  98. "*Sway*"
  99. "*Speed Test*"
  100. "*Dolby*"
  101. #Optional: Typically not removed but you can if you need to for some reason
  102. #"*Microsoft.Advertising.Xaml_10.1712.5.0_x64__8wekyb3d8bbwe*"
  103. #"*Microsoft.Advertising.Xaml_10.1712.5.0_x86__8wekyb3d8bbwe*"
  104. #"*Microsoft.BingWeather*"
  105. #"*Microsoft.MSPaint*"
  106. #"*Microsoft.MicrosoftStickyNotes*"
  107. #"*Microsoft.Windows.Photos*"
  108. #"*Microsoft.WindowsCalculator*"
  109. #"*Microsoft.WindowsStore*"
  110. )
  111. foreach ($Bloat in $Bloatware) {
  112. Get-AppxPackage -Name $Bloat| Remove-AppxPackage
  113. Get-AppxProvisionedPackage -Online | Where-Object DisplayName -like $Bloat | Remove-AppxProvisionedPackage -Online
  114. Write-Output "Trying to remove $Bloat."
  115. }
  116. }
  117. Function Remove-Keys {
  118. #These are the registry keys that it will delete.
  119. $Keys = @(
  120. #Remove Background Tasks
  121. "HKCR:\Extensions\ContractId\Windows.BackgroundTasks\PackageId\46928bounde.EclipseManager_2.2.4.51_neutral__a5h4egax66k6y"
  122. "HKCR:\Extensions\ContractId\Windows.BackgroundTasks\PackageId\ActiproSoftwareLLC.562882FEEB491_2.6.18.18_neutral__24pqs290vpjk0"
  123. "HKCR:\Extensions\ContractId\Windows.BackgroundTasks\PackageId\Microsoft.MicrosoftOfficeHub_17.7909.7600.0_x64__8wekyb3d8bbwe"
  124. "HKCR:\Extensions\ContractId\Windows.BackgroundTasks\PackageId\Microsoft.PPIProjection_10.0.15063.0_neutral_neutral_cw5n1h2txyewy"
  125. "HKCR:\Extensions\ContractId\Windows.BackgroundTasks\PackageId\Microsoft.XboxGameCallableUI_1000.15063.0.0_neutral_neutral_cw5n1h2txyewy"
  126. "HKCR:\Extensions\ContractId\Windows.BackgroundTasks\PackageId\Microsoft.XboxGameCallableUI_1000.16299.15.0_neutral_neutral_cw5n1h2txyewy"
  127. #Windows File
  128. "HKCR:\Extensions\ContractId\Windows.File\PackageId\ActiproSoftwareLLC.562882FEEB491_2.6.18.18_neutral__24pqs290vpjk0"
  129. #Registry keys to delete if they aren't uninstalled by RemoveAppXPackage/RemoveAppXProvisionedPackage
  130. "HKCR:\Extensions\ContractId\Windows.Launch\PackageId\46928bounde.EclipseManager_2.2.4.51_neutral__a5h4egax66k6y"
  131. "HKCR:\Extensions\ContractId\Windows.Launch\PackageId\ActiproSoftwareLLC.562882FEEB491_2.6.18.18_neutral__24pqs290vpjk0"
  132. "HKCR:\Extensions\ContractId\Windows.Launch\PackageId\Microsoft.PPIProjection_10.0.15063.0_neutral_neutral_cw5n1h2txyewy"
  133. "HKCR:\Extensions\ContractId\Windows.Launch\PackageId\Microsoft.XboxGameCallableUI_1000.15063.0.0_neutral_neutral_cw5n1h2txyewy"
  134. "HKCR:\Extensions\ContractId\Windows.Launch\PackageId\Microsoft.XboxGameCallableUI_1000.16299.15.0_neutral_neutral_cw5n1h2txyewy"
  135. #Scheduled Tasks to delete
  136. "HKCR:\Extensions\ContractId\Windows.PreInstalledConfigTask\PackageId\Microsoft.MicrosoftOfficeHub_17.7909.7600.0_x64__8wekyb3d8bbwe"
  137. #Windows Protocol Keys
  138. "HKCR:\Extensions\ContractId\Windows.Protocol\PackageId\ActiproSoftwareLLC.562882FEEB491_2.6.18.18_neutral__24pqs290vpjk0"
  139. "HKCR:\Extensions\ContractId\Windows.Protocol\PackageId\Microsoft.PPIProjection_10.0.15063.0_neutral_neutral_cw5n1h2txyewy"
  140. "HKCR:\Extensions\ContractId\Windows.Protocol\PackageId\Microsoft.XboxGameCallableUI_1000.15063.0.0_neutral_neutral_cw5n1h2txyewy"
  141. "HKCR:\Extensions\ContractId\Windows.Protocol\PackageId\Microsoft.XboxGameCallableUI_1000.16299.15.0_neutral_neutral_cw5n1h2txyewy"
  142. #Windows Share Target
  143. "HKCR:\Extensions\ContractId\Windows.ShareTarget\PackageId\ActiproSoftwareLLC.562882FEEB491_2.6.18.18_neutral__24pqs290vpjk0"
  144. )
  145. #This writes the output of each key it is removing and also removes the keys listed above.
  146. ForEach ($Key in $Keys) {
  147. Write-Output "Removing $Key from registry"
  148. Remove-Item $Key -Recurse
  149. }
  150. }
  151. Function Protect-Privacy {
  152. #Disables Windows Feedback Experience
  153. Write-Output "Disabling Windows Feedback Experience program"
  154. $Advertising = "HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\AdvertisingInfo"
  155. If (Test-Path $Advertising) {
  156. Set-ItemProperty $Advertising Enabled -Value 0
  157. }
  158. #Stops Cortana from being used as part of your Windows Search Function
  159. Write-Output "Stopping Cortana from being used as part of your Windows Search Function"
  160. $Search = "HKLM:\SOFTWARE\Policies\Microsoft\Windows\Windows Search"
  161. If (Test-Path $Search) {
  162. Set-ItemProperty $Search AllowCortana -Value 0
  163. }
  164. #Disables Web Search in Start Menu
  165. Write-Output "Disabling Bing Search in Start Menu"
  166. $WebSearch = "HKLM:\SOFTWARE\Policies\Microsoft\Windows\Windows Search"
  167. Set-ItemProperty "HKCU:\SOFTWARE\Microsoft\Windows\CurrentVersion\Search" BingSearchEnabled -Value 0
  168. If (!(Test-Path $WebSearch)) {
  169. New-Item $WebSearch
  170. }
  171. Set-ItemProperty $WebSearch DisableWebSearch -Value 1
  172. #Stops the Windows Feedback Experience from sending anonymous data
  173. Write-Output "Stopping the Windows Feedback Experience program"
  174. $Period = "HKCU:\Software\Microsoft\Siuf\Rules"
  175. If (!(Test-Path $Period)) {
  176. New-Item $Period
  177. }
  178. Set-ItemProperty $Period PeriodInNanoSeconds -Value 0
  179. #Prevents bloatware applications from returning and removes Start Menu suggestions
  180. Write-Output "Adding Registry key to prevent bloatware apps from returning"
  181. $registryPath = "HKLM:\SOFTWARE\Policies\Microsoft\Windows\CloudContent"
  182. $registryOEM = "HKCU:\SOFTWARE\Microsoft\Windows\CurrentVersion\ContentDeliveryManager"
  183. If (!(Test-Path $registryPath)) {
  184. New-Item $registryPath
  185. }
  186. Set-ItemProperty $registryPath DisableWindowsConsumerFeatures -Value 1
  187. If (!(Test-Path $registryOEM)) {
  188. New-Item $registryOEM
  189. }
  190. Set-ItemProperty $registryOEM ContentDeliveryAllowed -Value 0
  191. Set-ItemProperty $registryOEM OemPreInstalledAppsEnabled -Value 0
  192. Set-ItemProperty $registryOEM PreInstalledAppsEnabled -Value 0
  193. Set-ItemProperty $registryOEM PreInstalledAppsEverEnabled -Value 0
  194. Set-ItemProperty $registryOEM SilentInstalledAppsEnabled -Value 0
  195. Set-ItemProperty $registryOEM SystemPaneSuggestionsEnabled -Value 0
  196. #Preping mixed Reality Portal for removal
  197. Write-Output "Setting Mixed Reality Portal value to 0 so that you can uninstall it in Settings"
  198. $Holo = "HKCU:\Software\Microsoft\Windows\CurrentVersion\Holographic"
  199. If (Test-Path $Holo) {
  200. Set-ItemProperty $Holo FirstRunSucceeded -Value 0
  201. }
  202. #Disables Wi-fi Sense
  203. Write-Output "Disabling Wi-Fi Sense"
  204. $WifiSense1 = "HKLM:\SOFTWARE\Microsoft\PolicyManager\default\WiFi\AllowWiFiHotSpotReporting"
  205. $WifiSense2 = "HKLM:\SOFTWARE\Microsoft\PolicyManager\default\WiFi\AllowAutoConnectToWiFiSenseHotspots"
  206. $WifiSense3 = "HKLM:\SOFTWARE\Microsoft\WcmSvc\wifinetworkmanager\config"
  207. If (!(Test-Path $WifiSense1)) {
  208. New-Item $WifiSense1
  209. }
  210. Set-ItemProperty $WifiSense1 Value -Value 0
  211. If (!(Test-Path $WifiSense2)) {
  212. New-Item $WifiSense2
  213. }
  214. Set-ItemProperty $WifiSense2 Value -Value 0
  215. Set-ItemProperty $WifiSense3 AutoConnectAllowedOEM -Value 0
  216. #Disables live tiles
  217. Write-Output "Disabling live tiles"
  218. $Live = "HKCU:\SOFTWARE\Policies\Microsoft\Windows\CurrentVersion\PushNotifications"
  219. If (!(Test-Path $Live)) {
  220. New-Item $Live
  221. }
  222. Set-ItemProperty $Live NoTileApplicationNotification -Value 1
  223. #Turns off Data Collection via the AllowTelemtry key by changing it to 0
  224. Write-Output "Turning off Data Collection"
  225. $DataCollection1 = "HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\Policies\DataCollection"
  226. $DataCollection2 = "HKLM:\SOFTWARE\Policies\Microsoft\Windows\DataCollection"
  227. $DataCollection3 = "HKLM:\SOFTWARE\Wow6432Node\Microsoft\Windows\CurrentVersion\Policies\DataCollection"
  228. If (Test-Path $DataCollection1) {
  229. Set-ItemProperty $DataCollection1 AllowTelemetry -Value 0
  230. }
  231. If (Test-Path $DataCollection2) {
  232. Set-ItemProperty $DataCollection2 AllowTelemetry -Value 0
  233. }
  234. If (Test-Path $DataCollection3) {
  235. Set-ItemProperty $DataCollection3 AllowTelemetry -Value 0
  236. }
  237. #Disabling Location Tracking
  238. Write-Output "Disabling Location Tracking"
  239. $SensorState = "HKLM:\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Sensor\Overrides\{BFA794E4-F964-4FDB-90F6-51056BFE4B44}"
  240. $LocationConfig = "HKLM:\SYSTEM\CurrentControlSet\Services\lfsvc\Service\Configuration"
  241. If (!(Test-Path $SensorState)) {
  242. New-Item $SensorState
  243. }
  244. Set-ItemProperty $SensorState SensorPermissionState -Value 0
  245. If (!(Test-Path $LocationConfig)) {
  246. New-Item $LocationConfig
  247. }
  248. Set-ItemProperty $LocationConfig Status -Value 0
  249. #Disables People icon on Taskbar
  250. Write-Output "Disabling People icon on Taskbar"
  251. $People = 'HKCU:\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\Advanced\People'
  252. If (Test-Path $People) {
  253. Set-ItemProperty $People -Name PeopleBand -Value 0
  254. }
  255. #Disables scheduled tasks that are considered unnecessary
  256. Write-Output "Disabling scheduled tasks"
  257. Get-ScheduledTask XblGameSaveTaskLogon | Disable-ScheduledTask
  258. Get-ScheduledTask XblGameSaveTask | Disable-ScheduledTask
  259. Get-ScheduledTask Consolidator | Disable-ScheduledTask
  260. Get-ScheduledTask UsbCeip | Disable-ScheduledTask
  261. Get-ScheduledTask DmClient | Disable-ScheduledTask
  262. Get-ScheduledTask DmClientOnScenarioDownload | Disable-ScheduledTask
  263. Write-Output "Stopping and disabling Diagnostics Tracking Service"
  264. #Disabling the Diagnostics Tracking Service
  265. Stop-Service "DiagTrack"
  266. Set-Service "DiagTrack" -StartupType Disabled
  267. Write-Output "Removing CloudStore from registry if it exists"
  268. $CloudStore = 'HKCU:\Software\Microsoft\Windows\CurrentVersion\CloudStore'
  269. If (Test-Path $CloudStore) {
  270. Stop-Process Explorer.exe -Force
  271. Remove-Item $CloudStore -Recurse -Force
  272. Start-Process Explorer.exe -Wait
  273. }
  274. }
  275. Function DisableCortana {
  276. Write-Host "Disabling Cortana"
  277. $Cortana1 = "HKCU:\SOFTWARE\Microsoft\Personalization\Settings"
  278. $Cortana2 = "HKCU:\SOFTWARE\Microsoft\InputPersonalization"
  279. $Cortana3 = "HKCU:\SOFTWARE\Microsoft\InputPersonalization\TrainedDataStore"
  280. If (!(Test-Path $Cortana1)) {
  281. New-Item $Cortana1
  282. }
  283. Set-ItemProperty $Cortana1 AcceptedPrivacyPolicy -Value 0
  284. If (!(Test-Path $Cortana2)) {
  285. New-Item $Cortana2
  286. }
  287. Set-ItemProperty $Cortana2 RestrictImplicitTextCollection -Value 1
  288. Set-ItemProperty $Cortana2 RestrictImplicitInkCollection -Value 1
  289. If (!(Test-Path $Cortana3)) {
  290. New-Item $Cortana3
  291. }
  292. Set-ItemProperty $Cortana3 HarvestContacts -Value 0
  293. }
  294. Function EnableCortana {
  295. Write-Host "Re-enabling Cortana"
  296. $Cortana1 = "HKCU:\SOFTWARE\Microsoft\Personalization\Settings"
  297. $Cortana2 = "HKCU:\SOFTWARE\Microsoft\InputPersonalization"
  298. $Cortana3 = "HKCU:\SOFTWARE\Microsoft\InputPersonalization\TrainedDataStore"
  299. If (!(Test-Path $Cortana1)) {
  300. New-Item $Cortana1
  301. }
  302. Set-ItemProperty $Cortana1 AcceptedPrivacyPolicy -Value 1
  303. If (!(Test-Path $Cortana2)) {
  304. New-Item $Cortana2
  305. }
  306. Set-ItemProperty $Cortana2 RestrictImplicitTextCollection -Value 0
  307. Set-ItemProperty $Cortana2 RestrictImplicitInkCollection -Value 0
  308. If (!(Test-Path $Cortana3)) {
  309. New-Item $Cortana3
  310. }
  311. Set-ItemProperty $Cortana3 HarvestContacts -Value 1
  312. }
  313. Function Stop-EdgePDF {
  314. #Stops edge from taking over as the default .PDF viewer
  315. Write-Output "Stopping Edge from taking over as the default .PDF viewer"
  316. $NoPDF = "HKCR:\.pdf"
  317. $NoProgids = "HKCR:\.pdf\OpenWithProgids"
  318. $NoWithList = "HKCR:\.pdf\OpenWithList"
  319. If (!(Get-ItemProperty $NoPDF NoOpenWith)) {
  320. New-ItemProperty $NoPDF NoOpenWith
  321. }
  322. If (!(Get-ItemProperty $NoPDF NoStaticDefaultVerb)) {
  323. New-ItemProperty $NoPDF NoStaticDefaultVerb
  324. }
  325. If (!(Get-ItemProperty $NoProgids NoOpenWith)) {
  326. New-ItemProperty $NoProgids NoOpenWith
  327. }
  328. If (!(Get-ItemProperty $NoProgids NoStaticDefaultVerb)) {
  329. New-ItemProperty $NoProgids NoStaticDefaultVerb
  330. }
  331. If (!(Get-ItemProperty $NoWithList NoOpenWith)) {
  332. New-ItemProperty $NoWithList NoOpenWith
  333. }
  334. If (!(Get-ItemProperty $NoWithList NoStaticDefaultVerb)) {
  335. New-ItemProperty $NoWithList NoStaticDefaultVerb
  336. }
  337. #Appends an underscore '_' to the Registry key for Edge
  338. $Edge = "HKCR:\AppXd4nrz8ff68srnhf9t5a8sbjyar1cr723_"
  339. If (Test-Path $Edge) {
  340. Set-Item $Edge AppXd4nrz8ff68srnhf9t5a8sbjyar1cr723_
  341. }
  342. }
  343. Function Revert-Changes {
  344. #This function will revert the changes you made when running the Start-Debloat function.
  345. #This line reinstalls all of the bloatware that was removed
  346. Get-AppxPackage -AllUsers | ForEach {Add-AppxPackage -Verbose -DisableDevelopmentMode -Register "$($_.InstallLocation)\AppXManifest.xml"}
  347. #Tells Windows to enable your advertising information.
  348. Write-Output "Re-enabling key to show advertisement information"
  349. $Advertising = "HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\AdvertisingInfo"
  350. If (Test-Path $Advertising) {
  351. Set-ItemProperty $Advertising Enabled -Value 1
  352. }
  353. #Enables Cortana to be used as part of your Windows Search Function
  354. Write-Output "Re-enabling Cortana to be used in your Windows Search"
  355. $Search = "HKLM:\SOFTWARE\Policies\Microsoft\Windows\Windows Search"
  356. If (Test-Path $Search) {
  357. Set-ItemProperty $Search AllowCortana -Value 1
  358. }
  359. #Re-enables the Windows Feedback Experience for sending anonymous data
  360. Write-Output "Re-enabling Windows Feedback Experience"
  361. $Period = "HKCU:\Software\Microsoft\Siuf\Rules"
  362. If (!(Test-Path $Period)) {
  363. New-Item $Period
  364. }
  365. Set-ItemProperty $Period PeriodInNanoSeconds -Value 1
  366. #Enables bloatware applications
  367. Write-Output "Adding Registry key to allow bloatware apps to return"
  368. $registryPath = "HKLM:\SOFTWARE\Policies\Microsoft\Windows\CloudContent"
  369. If (!(Test-Path $registryPath)) {
  370. New-Item $registryPath
  371. }
  372. Set-ItemProperty $registryPath DisableWindowsConsumerFeatures -Value 0
  373. #Changes Mixed Reality Portal Key 'FirstRunSucceeded' to 1
  374. Write-Output "Setting Mixed Reality Portal value to 1"
  375. $Holo = "HKCU:\Software\Microsoft\Windows\CurrentVersion\Holographic"
  376. If (Test-Path $Holo) {
  377. Set-ItemProperty $Holo FirstRunSucceeded -Value 1
  378. }
  379. #Re-enables live tiles
  380. Write-Output "Enabling live tiles"
  381. $Live = "HKCU:\SOFTWARE\Policies\Microsoft\Windows\CurrentVersion\PushNotifications"
  382. If (!(Test-Path $Live)) {
  383. New-Item $Live
  384. }
  385. Set-ItemProperty $Live NoTileApplicationNotification -Value 0
  386. #Re-enables data collection
  387. Write-Output "Re-enabling data collection"
  388. $DataCollection = "HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\Policies\DataCollection"
  389. If (!(Test-Path $DataCollection)) {
  390. New-Item $DataCollection
  391. }
  392. Set-ItemProperty $DataCollection AllowTelemetry -Value 1
  393. #Re-enables People Icon on Taskbar
  394. Write-Output "Enabling People icon on Taskbar"
  395. $People = "HKCU:\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\Advanced\People"
  396. If (!(Test-Path $People)) {
  397. New-Item $People
  398. }
  399. Set-ItemProperty $People PeopleBand -Value 1
  400. #Re-enables suggestions on start menu
  401. Write-Output "Enabling suggestions on the Start Menu"
  402. $Suggestions = "HKCU:\Software\Microsoft\Windows\CurrentVersion\ContentDeliveryManager"
  403. If (!(Test-Path $Suggestions)) {
  404. New-Item $Suggestions
  405. }
  406. Set-ItemProperty $Suggestions SystemPaneSuggestionsEnabled -Value 1
  407. #Re-enables scheduled tasks that were disabled when running the Debloat switch
  408. Write-Output "Enabling scheduled tasks that were disabled"
  409. Get-ScheduledTask XblGameSaveTaskLogon | Enable-ScheduledTask
  410. Get-ScheduledTask XblGameSaveTask | Enable-ScheduledTask
  411. Get-ScheduledTask Consolidator | Enable-ScheduledTask
  412. Get-ScheduledTask UsbCeip | Enable-ScheduledTask
  413. Get-ScheduledTask DmClient | Enable-ScheduledTask
  414. Get-ScheduledTask DmClientOnScenarioDownload | Enable-ScheduledTask
  415. Write-Output "Re-enabling and starting WAP Push Service"
  416. #Enable and start WAP Push Service
  417. Set-Service "dmwappushservice" -StartupType Automatic
  418. Start-Service "dmwappushservice"
  419. Write-Output "Re-enabling and starting the Diagnostics Tracking Service"
  420. #Enabling the Diagnostics Tracking Service
  421. Set-Service "DiagTrack" -StartupType Automatic
  422. Start-Service "DiagTrack"
  423. Write-Output "Restoring 3D Objects in the 'My Computer' submenu in explorer"
  424. #Restoring 3D Objects in the 'My Computer' submenu in explorer
  425. Restore3dObjects
  426. }
  427. Function CheckDMWService {
  428. Param([switch]$Debloat)
  429. If (Get-Service -Name dmwappushservice | Where-Object {$_.StartType -eq "Disabled"}) {
  430. Set-Service -Name dmwappushservice -StartupType Automatic
  431. }
  432. If (Get-Service -Name dmwappushservice | Where-Object {$_.Status -eq "Stopped"}) {
  433. Start-Service -Name dmwappushservice
  434. }
  435. }
  436. Function Enable-EdgePDF {
  437. Write-Output "Setting Edge back to default"
  438. $NoPDF = "HKCR:\.pdf"
  439. $NoProgids = "HKCR:\.pdf\OpenWithProgids"
  440. $NoWithList = "HKCR:\.pdf\OpenWithList"
  441. #Sets edge back to default
  442. If (Get-ItemProperty $NoPDF NoOpenWith) {
  443. Remove-ItemProperty $NoPDF NoOpenWith
  444. }
  445. If (Get-ItemProperty $NoPDF NoStaticDefaultVerb) {
  446. Remove-ItemProperty $NoPDF NoStaticDefaultVerb
  447. }
  448. If (Get-ItemProperty $NoProgids NoOpenWith) {
  449. Remove-ItemProperty $NoProgids NoOpenWith
  450. }
  451. If (Get-ItemProperty $NoProgids NoStaticDefaultVerb) {
  452. Remove-ItemProperty $NoProgids NoStaticDefaultVerb
  453. }
  454. If (Get-ItemProperty $NoWithList NoOpenWith) {
  455. Remove-ItemProperty $NoWithList NoOpenWith
  456. }
  457. If (Get-ItemProperty $NoWithList NoStaticDefaultVerb) {
  458. Remove-ItemProperty $NoWithList NoStaticDefaultVerb
  459. }
  460. #Removes an underscore '_' from the Registry key for Edge
  461. $Edge2 = "HKCR:\AppXd4nrz8ff68srnhf9t5a8sbjyar1cr723_"
  462. If (Test-Path $Edge2) {
  463. Set-Item $Edge2 AppXd4nrz8ff68srnhf9t5a8sbjyar1cr723
  464. }
  465. }
  466. Function FixWhitelistedApps {
  467. If (!(Get-AppxPackage -AllUsers | Select Microsoft.Paint3D, Microsoft.WindowsCalculator, Microsoft.WindowsStore, Microsoft.Windows.Photos)) {
  468. #Credit to abulgatz for these 4 lines of code
  469. Get-AppxPackage -allusers Microsoft.Paint3D | Foreach {Add-AppxPackage -DisableDevelopmentMode -Register "$($_.InstallLocation)\AppXManifest.xml"}
  470. Get-AppxPackage -allusers Microsoft.WindowsCalculator | Foreach {Add-AppxPackage -DisableDevelopmentMode -Register "$($_.InstallLocation)\AppXManifest.xml"}
  471. Get-AppxPackage -allusers Microsoft.WindowsStore | Foreach {Add-AppxPackage -DisableDevelopmentMode -Register "$($_.InstallLocation)\AppXManifest.xml"}
  472. Get-AppxPackage -allusers Microsoft.Windows.Photos | Foreach {Add-AppxPackage -DisableDevelopmentMode -Register "$($_.InstallLocation)\AppXManifest.xml"}
  473. }
  474. }
  475. Function UninstallOneDrive {
  476. Write-Host "Checking for pre-existing files and folders located in the OneDrive folders..."
  477. Start-Sleep 1
  478. If (Test-Path "$env:USERPROFILE\OneDrive\*") {
  479. Write-Host "Files found within the OneDrive folder! Checking to see if a folder named OneDriveBackupFiles exists."
  480. Start-Sleep 1
  481. If (Test-Path "$env:USERPROFILE\Desktop\OneDriveBackupFiles") {
  482. Write-Host "A folder named OneDriveBackupFiles already exists on your desktop. All files from your OneDrive location will be moved to that folder."
  483. }
  484. else {
  485. If (!(Test-Path "$env:USERPROFILE\Desktop\OneDriveBackupFiles")) {
  486. 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."
  487. New-item -Path "$env:USERPROFILE\Desktop" -Name "OneDriveBackupFiles"-ItemType Directory -Force
  488. Write-Host "Successfully created the folder 'OneDriveBackupFiles' on your desktop."
  489. }
  490. }
  491. Start-Sleep 1
  492. Move-Item -Path "$env:USERPROFILE\OneDrive\*" -Destination "$env:USERPROFILE\Desktop\OneDriveBackupFiles" -Force
  493. Write-Host "Successfully moved all files/folders from your OneDrive folder to the folder 'OneDriveBackupFiles' on your desktop."
  494. Start-Sleep 1
  495. Write-Host "Proceeding with the removal of OneDrive."
  496. Start-Sleep 1
  497. }
  498. Else {
  499. 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."
  500. Start-Sleep 1
  501. Write-Host "Enabling the Group Policy 'Prevent the usage of OneDrive for File Storage'."
  502. $OneDriveKey = 'HKLM:Software\Policies\Microsoft\Windows\OneDrive'
  503. If (!(Test-Path $OneDriveKey)) {
  504. Mkdir $OneDriveKey
  505. Set-ItemProperty $OneDriveKey -Name OneDrive -Value DisableFileSyncNGSC
  506. }
  507. Set-ItemProperty $OneDriveKey -Name OneDrive -Value DisableFileSyncNGSC
  508. }
  509. Write-Host "Uninstalling OneDrive. Please wait..."
  510. New-PSDrive HKCR -PSProvider Registry -Root HKEY_CLASSES_ROOT
  511. $onedrive = "$env:SYSTEMROOT\SysWOW64\OneDriveSetup.exe"
  512. $ExplorerReg1 = "HKCR:\CLSID\{018D5C66-4533-4307-9B53-224DE2ED1FE6}"
  513. $ExplorerReg2 = "HKCR:\Wow6432Node\CLSID\{018D5C66-4533-4307-9B53-224DE2ED1FE6}"
  514. Stop-Process -Name "OneDrive*"
  515. Start-Sleep 2
  516. If (!(Test-Path $onedrive)) {
  517. $onedrive = "$env:SYSTEMROOT\System32\OneDriveSetup.exe"
  518. New-PSDrive HKCR -PSProvider Registry -Root HKEY_CLASSES_ROOT
  519. $onedrive = "$env:SYSTEMROOT\SysWOW64\OneDriveSetup.exe"
  520. $ExplorerReg1 = "HKCR:\CLSID\{018D5C66-4533-4307-9B53-224DE2ED1FE6}"
  521. $ExplorerReg2 = "HKCR:\Wow6432Node\CLSID\{018D5C66-4533-4307-9B53-224DE2ED1FE6}"
  522. Stop-Process -Name "OneDrive*"
  523. Start-Sleep 2
  524. If (!(Test-Path $onedrive)) {
  525. $onedrive = "$env:SYSTEMROOT\System32\OneDriveSetup.exe"
  526. }
  527. Start-Process $onedrive "/uninstall" -NoNewWindow -Wait
  528. Start-Sleep 2
  529. Write-Output "Stopping explorer"
  530. Start-Sleep 1
  531. taskkill.exe /F /IM explorer.exe
  532. Start-Sleep 3
  533. Write-Output "Removing leftover files"
  534. Remove-Item "$env:USERPROFILE\OneDrive" -Force -Recurse
  535. Remove-Item "$env:LOCALAPPDATA\Microsoft\OneDrive" -Force -Recurse
  536. Remove-Item "$env:PROGRAMDATA\Microsoft OneDrive" -Force -Recurse
  537. If (Test-Path "$env:SYSTEMDRIVE\OneDriveTemp") {
  538. Remove-Item "$env:SYSTEMDRIVE\OneDriveTemp" -Force -Recurse
  539. }
  540. Write-Output "Removing OneDrive from windows explorer"
  541. If (!(Test-Path $ExplorerReg1)) {
  542. New-Item $ExplorerReg1
  543. }
  544. Set-ItemProperty $ExplorerReg1 System.IsPinnedToNameSpaceTree -Value 0
  545. If (!(Test-Path $ExplorerReg2)) {
  546. New-Item $ExplorerReg2
  547. }
  548. Set-ItemProperty $ExplorerReg2 System.IsPinnedToNameSpaceTree -Value 0
  549. Write-Output "Restarting Explorer that was shut down before."
  550. Start-Process explorer.exe -NoNewWindow
  551. Write-Host "Enabling the Group Policy 'Prevent the usage of OneDrive for File Storage'."
  552. $OneDriveKey = 'HKLM:Software\Policies\Microsoft\Windows\OneDrive'
  553. If (!(Test-Path $OneDriveKey)) {
  554. Mkdir $OneDriveKey
  555. }
  556. Start-Process $onedrive "/uninstall" -NoNewWindow -Wait
  557. Start-Sleep 2
  558. Write-Host "Stopping explorer"
  559. Start-Sleep 1
  560. taskkill.exe /F /IM explorer.exe
  561. Start-Sleep 3
  562. Write-Host "Removing leftover files"
  563. If (Test-Path "$env:USERPROFILE\OneDrive") {
  564. Remove-Item "$env:USERPROFILE\OneDrive" -Force -Recurse
  565. }
  566. If (Test-Path "$env:LOCALAPPDATA\Microsoft\OneDrive") {
  567. Remove-Item "$env:LOCALAPPDATA\Microsoft\OneDrive" -Force -Recurse
  568. }
  569. If (Test-Path "$env:PROGRAMDATA\Microsoft OneDrive") {
  570. Remove-Item "$env:PROGRAMDATA\Microsoft OneDrive" -Force -Recurse
  571. }
  572. If (Test-Path "$env:SYSTEMDRIVE\OneDriveTemp") {
  573. Remove-Item "$env:SYSTEMDRIVE\OneDriveTemp" -Force -Recurse
  574. }
  575. Write-Host "Removing OneDrive from windows explorer"
  576. If (!(Test-Path $ExplorerReg1)) {
  577. New-Item $ExplorerReg1
  578. }
  579. Set-ItemProperty $ExplorerReg1 System.IsPinnedToNameSpaceTree -Value 0
  580. If (!(Test-Path $ExplorerReg2)) {
  581. New-Item $ExplorerReg2
  582. }
  583. Set-ItemProperty $ExplorerReg2 System.IsPinnedToNameSpaceTree -Value 0
  584. Write-Host "Restarting Explorer that was shut down before."
  585. Start-Process explorer.exe -NoNewWindow
  586. Write-Host "OneDrive has been successfully uninstalled!"
  587. Remove-item env:OneDrive
  588. }
  589. }
  590. Function UnpinStart {
  591. # https://superuser.com/a/1442733
  592. #Requires -RunAsAdministrator
  593. $START_MENU_LAYOUT = @"
  594. <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">
  595. <LayoutOptions StartTileGroupCellWidth="6" />
  596. <DefaultLayoutOverride>
  597. <StartLayoutCollection>
  598. <defaultlayout:StartLayout GroupCellWidth="6" />
  599. </StartLayoutCollection>
  600. </DefaultLayoutOverride>
  601. </LayoutModificationTemplate>
  602. "@
  603. $layoutFile="C:\Windows\StartMenuLayout.xml"
  604. #Delete layout file if it already exists
  605. If(Test-Path $layoutFile)
  606. {
  607. Remove-Item $layoutFile
  608. }
  609. #Creates the blank layout file
  610. $START_MENU_LAYOUT | Out-File $layoutFile -Encoding ASCII
  611. $regAliases = @("HKLM", "HKCU")
  612. #Assign the start layout and force it to apply with "LockedStartLayout" at both the machine and user level
  613. foreach ($regAlias in $regAliases){
  614. $basePath = $regAlias + ":\SOFTWARE\Policies\Microsoft\Windows"
  615. $keyPath = $basePath + "\Explorer"
  616. IF(!(Test-Path -Path $keyPath)) {
  617. New-Item -Path $basePath -Name "Explorer"
  618. }
  619. Set-ItemProperty -Path $keyPath -Name "LockedStartLayout" -Value 1
  620. Set-ItemProperty -Path $keyPath -Name "StartLayoutFile" -Value $layoutFile
  621. }
  622. #Restart Explorer, open the start menu (necessary to load the new layout), and give it a few seconds to process
  623. Stop-Process -name explorer
  624. Start-Sleep -s 5
  625. $wshell = New-Object -ComObject wscript.shell; $wshell.SendKeys('^{ESCAPE}')
  626. Start-Sleep -s 5
  627. #Enable the ability to pin items again by disabling "LockedStartLayout"
  628. foreach ($regAlias in $regAliases){
  629. $basePath = $regAlias + ":\SOFTWARE\Policies\Microsoft\Windows"
  630. $keyPath = $basePath + "\Explorer"
  631. Set-ItemProperty -Path $keyPath -Name "LockedStartLayout" -Value 0
  632. }
  633. #Restart Explorer and delete the layout file
  634. Stop-Process -name explorer
  635. # Uncomment the next line to make clean start menu default for all new users
  636. #Import-StartLayout -LayoutPath $layoutFile -MountPath $env:SystemDrive\
  637. Remove-Item $layoutFile
  638. }
  639. Function Remove3dObjects {
  640. #Removes 3D Objects from the 'My Computer' submenu in explorer
  641. Write-Host "Removing 3D Objects from explorer 'My Computer' submenu"
  642. $Objects32 = "HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\MyComputer\NameSpace\{0DB7E03F-FC29-4DC6-9020-FF41B59E513A}"
  643. $Objects64 = "HKLM:\SOFTWARE\WOW6432Node\Microsoft\Windows\CurrentVersion\Explorer\MyComputer\NameSpace\{0DB7E03F-FC29-4DC6-9020-FF41B59E513A}"
  644. If (Test-Path $Objects32) {
  645. Remove-Item $Objects32 -Recurse
  646. }
  647. If (Test-Path $Objects64) {
  648. Remove-Item $Objects64 -Recurse
  649. }
  650. }
  651. Function Restore3dObjects {
  652. #Restores 3D Objects from the 'My Computer' submenu in explorer
  653. Write-Host "Restoring 3D Objects from explorer 'My Computer' submenu"
  654. $Objects32 = "HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\MyComputer\NameSpace\{0DB7E03F-FC29-4DC6-9020-FF41B59E513A}"
  655. $Objects64 = "HKLM:\SOFTWARE\WOW6432Node\Microsoft\Windows\CurrentVersion\Explorer\MyComputer\NameSpace\{0DB7E03F-FC29-4DC6-9020-FF41B59E513A}"
  656. If (!(Test-Path $Objects32)) {
  657. New-Item $Objects32
  658. }
  659. If (!(Test-Path $Objects64)) {
  660. New-Item $Objects64
  661. }
  662. }
  663. #Function DisableLastUsedFilesAndFolders {
  664. # Write-Host = "Disable Explorer to show last used files and folders."
  665. # Invoke-Item (start powershell ((Split-Path $MyInvocation.InvocationName) + "\Individual Scripts\Disable Last Used Files and Folders View.ps1"))
  666. #}
  667. #Interactive prompt Debloat/Revert options
  668. $Button = [Windows.MessageBoxButton]::YesNoCancel
  669. $ErrorIco = [Windows.MessageBoxImage]::Error
  670. $Warn = [Windows.MessageBoxImage]::Warning
  671. $Ask = 'The following will allow you to either Debloat Windows 10 or to revert changes made after Debloating Windows 10.
  672. Select "Yes" to Debloat Windows 10
  673. Select "No" to Revert changes made by this script
  674. Select "Cancel" to stop the script.'
  675. $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."
  676. $EdgePdf = "Do you want to stop edge from taking over as the default PDF viewer?"
  677. $EdgePdf2 = "Do you want to revert changes that disabled Edge as the default PDF viewer?"
  678. $Reboot = "For some of the changes to properly take effect it is recommended to reboot your machine. Would you like to restart?"
  679. $OneDriveDelete = "Do you want to uninstall One Drive?"
  680. $Unpin = "Do you want to unpin all items from the Start menu?"
  681. $InstallNET = "Do you want to install .NET 3.5?"
  682. $LastUsedFilesFolders = "Do you want to hide last used files and folders in Explorer?"
  683. $LastUsedFilesFolders2 = "Do you want to show last used files and folders in Explorer?"
  684. $ClearLastUsedFilesFolders = "Do you want to clear last used files and folders?"
  685. $AeroShake = "Do you want to disable AeroShake?"
  686. $AeroShake2 = "Do you want to re-enable AeroShake?"
  687. $Prompt1 = [Windows.MessageBox]::Show($Ask, "Debloat or Revert", $Button, $ErrorIco)
  688. Switch ($Prompt1) {
  689. #This will debloat Windows 10
  690. Yes {
  691. #Everything is specific prompt
  692. $Prompt2 = [Windows.MessageBox]::Show($EverythingorSpecific, "Everything or Specific", $Button, $Warn)
  693. switch ($Prompt2) {
  694. Yes {
  695. #Creates a "drive" to access the HKCR (HKEY_CLASSES_ROOT)
  696. 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."
  697. New-PSDrive HKCR -PSProvider Registry -Root HKEY_CLASSES_ROOT
  698. Start-Sleep 1
  699. Write-Host "Uninstalling bloatware, please wait."
  700. DebloatAll
  701. Write-Host "Bloatware removed."
  702. Start-Sleep 1
  703. Write-Host "Removing specific registry keys."
  704. Remove-Keys
  705. Write-Host "Leftover bloatware registry keys removed."
  706. Start-Sleep 1
  707. Write-Host "Checking to see if any Whitelisted Apps were removed, and if so re-adding them."
  708. Start-Sleep 1
  709. FixWhitelistedApps
  710. Start-Sleep 1
  711. Write-Host "Disabling Cortana from search, disabling feedback to Microsoft, and disabling scheduled tasks that are considered to be telemetry or unnecessary."
  712. Protect-Privacy
  713. Start-Sleep 1
  714. DisableCortana
  715. Write-Host "Cortana disabled and removed from search, feedback to Microsoft has been disabled, and scheduled tasks are disabled."
  716. Start-Sleep 1
  717. Write-Host "Stopping and disabling Diagnostics Tracking Service"
  718. DisableDiagTrack
  719. Write-Host "Diagnostics Tracking Service disabled"
  720. Start-Sleep 1
  721. Write-Host "Disabling WAP push service"
  722. DisableWAPPush
  723. Start-Sleep 1
  724. Write-Host "Re-enabling DMWAppushservice if it was disabled"
  725. CheckDMWService
  726. Start-Sleep 1
  727. Write-Host "Removing 3D Objects from the 'My Computer' submenu in explorer"
  728. Remove3dObjects
  729. Start-Sleep 1
  730. }
  731. No {
  732. #Creates a "drive" to access the HKCR (HKEY_CLASSES_ROOT)
  733. 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."
  734. New-PSDrive HKCR -PSProvider Registry -Root HKEY_CLASSES_ROOT
  735. Start-Sleep 1
  736. Write-Host "Uninstalling bloatware, please wait."
  737. DebloatBlacklist
  738. Write-Host "Bloatware removed."
  739. Start-Sleep 1
  740. Write-Host "Removing specific registry keys."
  741. Remove-Keys
  742. Write-Host "Leftover bloatware registry keys removed."
  743. Start-Sleep 1
  744. Write-Host "Checking to see if any Whitelisted Apps were removed, and if so re-adding them."
  745. Start-Sleep 1
  746. FixWhitelistedApps
  747. Start-Sleep 1
  748. Write-Host "Disabling Cortana from search, disabling feedback to Microsoft, and disabling scheduled tasks that are considered to be telemetry or unnecessary."
  749. Protect-Privacy
  750. Start-Sleep 1
  751. DisableCortana
  752. Write-Host "Cortana disabled and removed from search, feedback to Microsoft has been disabled, and scheduled tasks are disabled."
  753. Start-Sleep 1
  754. Write-Host "Stopping and disabling Diagnostics Tracking Service"
  755. DisableDiagTrack
  756. Write-Host "Diagnostics Tracking Service disabled"
  757. Start-Sleep 1
  758. Write-Host "Disabling WAP push service"
  759. Start-Sleep 1
  760. DisableWAPPush
  761. Write-Host "Re-enabling DMWAppushservice if it was disabled"
  762. CheckDMWService
  763. Start-Sleep 1
  764. }
  765. }
  766. #Disabling EdgePDF prompt
  767. $Prompt3 = [Windows.MessageBox]::Show($EdgePdf, "Edge PDF", $Button, $Warn)
  768. Switch ($Prompt3) {
  769. Yes {
  770. Stop-EdgePDF
  771. Write-Host "Edge will no longer take over as the default PDF viewer."
  772. }
  773. No {
  774. Write-Host "You chose not to stop Edge from taking over as the default PDF viewer."
  775. }
  776. }
  777. #Prompt asking to delete OneDrive
  778. $Prompt4 = [Windows.MessageBox]::Show($OneDriveDelete, "Delete OneDrive", $Button, $ErrorIco)
  779. Switch ($Prompt4) {
  780. Yes {
  781. UninstallOneDrive
  782. Write-Host "OneDrive is now removed from the computer."
  783. }
  784. No {
  785. Write-Host "You have chosen to skip removing OneDrive from your machine."
  786. }
  787. }
  788. #Prompt asking if you'd like to unpin all start items
  789. $Prompt5 = [Windows.MessageBox]::Show($Unpin, "Unpin", $Button, $ErrorIco)
  790. Switch ($Prompt5) {
  791. Yes {
  792. UnpinStart
  793. Write-Host "Start Apps unpined."
  794. }
  795. No {
  796. Write-Host "Apps will remain pinned to the start menu."
  797. }
  798. }
  799. #Prompt asking if you want to install .NET
  800. $Prompt6 = [Windows.MessageBox]::Show($InstallNET, "Install .Net", $Button, $Warn)
  801. Switch ($Prompt6) {
  802. Yes {
  803. Write-Host "Initializing the installation of .NET 3.5..."
  804. DISM /Online /Enable-Feature /FeatureName:NetFx3 /All
  805. Write-Host ".NET 3.5 has been successfully installed!"
  806. }
  807. No {
  808. Write-Host "Skipping .NET install."
  809. }
  810. }
  811. # #Prompt asking if you want to deactivate Last Used Files and Folders
  812. # $Prompt7 = [Windows.MessageBox]::Show($LastUsedFilesFolders, "Deactivate Last Used Files and Folders", $Button, $Warn)
  813. # Switch ($Prompt7) {
  814. # Yes {
  815. # DisableLastUsedFilesAndFolders
  816. # Write-Host "Last Used Files and Folders will no longer been shown!"
  817. # }
  818. # No {
  819. # Write-Host "Skipping Hiding Last used Files and Folders."
  820. # }
  821. # }
  822. #Prompt asking if you'd like to reboot your machine
  823. $Prompt0 = [Windows.MessageBox]::Show($Reboot, "Reboot", $Button, $Warn)
  824. Switch ($Prompt0) {
  825. Yes {
  826. Write-Host "Unloading the HKCR drive..."
  827. Remove-PSDrive HKCR
  828. Start-Sleep 1
  829. Write-Host "Initiating reboot."
  830. Stop-Transcript
  831. Start-Sleep 2
  832. Restart-Computer
  833. }
  834. No {
  835. Write-Host "Unloading the HKCR drive..."
  836. Remove-PSDrive HKCR
  837. Start-Sleep 1
  838. Write-Host "Script has finished. Exiting."
  839. Stop-Transcript
  840. Start-Sleep 2
  841. Exit
  842. }
  843. }
  844. }
  845. No {
  846. Write-Host "Reverting changes..."
  847. 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."
  848. New-PSDrive HKCR -PSProvider Registry -Root HKEY_CLASSES_ROOT
  849. Revert-Changes
  850. #Prompt asking to revert edge changes as well
  851. $Prompt6 = [Windows.MessageBox]::Show($EdgePdf2, "Revert Edge", $Button, $ErrorIco)
  852. Switch ($Prompt6) {
  853. Yes {
  854. Enable-EdgePDF
  855. Write-Host "Edge will no longer be disabled from being used as the default Edge PDF viewer."
  856. }
  857. No {
  858. Write-Host "You have chosen to keep the setting that disallows Edge to be the default PDF viewer."
  859. }
  860. }
  861. #Prompt asking if you'd like to reboot your machine
  862. $Prompt0 = [Windows.MessageBox]::Show($Reboot, "Reboot", $Button, $Warn)
  863. Switch ($Prompt0) {
  864. Yes {
  865. Write-Host "Unloading the HKCR drive..."
  866. Remove-PSDrive HKCR
  867. Start-Sleep 1
  868. Write-Host "Initiating reboot."
  869. Stop-Transcript
  870. Start-Sleep 2
  871. Restart-Computer
  872. }
  873. No {
  874. Write-Host "Unloading the HKCR drive..."
  875. Remove-PSDrive HKCR
  876. Start-Sleep 1
  877. Write-Host "Script has finished. Exiting."
  878. Stop-Transcript
  879. Start-Sleep 2
  880. Exit
  881. }
  882. }
  883. }
  884. }