Windows10DebloaterGUI.ps1 62 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183
  1. Add-Type -AssemblyName System.Windows.Forms
  2. [System.Windows.Forms.Application]::EnableVisualStyles()
  3. #region begin GUI{
  4. $Form = New-Object system.Windows.Forms.Form
  5. $Form.ClientSize = '408,523'
  6. $Form.text = "Windows10Debloater"
  7. $Form.TopMost = $false
  8. $Debloat = New-Object system.Windows.Forms.Label
  9. $Debloat.text = "Debloat Options"
  10. $Debloat.AutoSize = $true
  11. $Debloat.width = 25
  12. $Debloat.height = 10
  13. $Debloat.location = New-Object System.Drawing.Point(9, 8)
  14. $Debloat.Font = 'Microsoft Sans Serif,12,style=Bold,Underline'
  15. $RemoveAllBloatware = New-Object system.Windows.Forms.Button
  16. $RemoveAllBloatware.text = "Remove All Bloatware"
  17. $RemoveAllBloatware.width = 142
  18. $RemoveAllBloatware.height = 40
  19. $RemoveAllBloatware.location = New-Object System.Drawing.Point(8, 32)
  20. $RemoveAllBloatware.Font = 'Microsoft Sans Serif,10'
  21. $RemoveBlacklist = New-Object system.Windows.Forms.Button
  22. $RemoveBlacklist.text = "Remove Bloatware With Blacklist"
  23. $RemoveBlacklist.width = 205
  24. $RemoveBlacklist.height = 37
  25. $RemoveBlacklist.location = New-Object System.Drawing.Point(9, 79)
  26. $RemoveBlacklist.Font = 'Microsoft Sans Serif,10'
  27. $Label1 = New-Object system.Windows.Forms.Label
  28. $Label1.text = "Revert Debloat "
  29. $Label1.AutoSize = $true
  30. $Label1.width = 25
  31. $Label1.height = 10
  32. $Label1.location = New-Object System.Drawing.Point(254, 7)
  33. $Label1.Font = 'Microsoft Sans Serif,12,style=Bold,Underline'
  34. $RevertChange = New-Object system.Windows.Forms.Button
  35. $RevertChange.text = "Revert Changes"
  36. $RevertChange.width = 113
  37. $RevertChange.height = 36
  38. $RevertChange.location = New-Object System.Drawing.Point(254, 32)
  39. $RevertChange.Font = 'Microsoft Sans Serif,10'
  40. $Label2 = New-Object system.Windows.Forms.Label
  41. $Label2.text = "Optional Privacy Changes/Fixes"
  42. $Label2.AutoSize = $true
  43. $Label2.width = 25
  44. $Label2.height = 10
  45. $Label2.location = New-Object System.Drawing.Point(9, 193)
  46. $Label2.Font = 'Microsoft Sans Serif,12,style=Bold,Underline'
  47. $DisableCortana = New-Object system.Windows.Forms.Button
  48. $DisableCortana.text = "Disable Cortana"
  49. $DisableCortana.width = 111
  50. $DisableCortana.height = 36
  51. $DisableCortana.location = New-Object System.Drawing.Point(9, 217)
  52. $DisableCortana.Font = 'Microsoft Sans Serif,10'
  53. $EnableCortana = New-Object system.Windows.Forms.Button
  54. $EnableCortana.text = "Enable Cortana"
  55. $EnableCortana.width = 112
  56. $EnableCortana.height = 36
  57. $EnableCortana.location = New-Object System.Drawing.Point(9, 260)
  58. $EnableCortana.Font = 'Microsoft Sans Serif,10'
  59. $StopEdgePDFTakeover = New-Object system.Windows.Forms.Button
  60. $StopEdgePDFTakeover.text = "Stop Edge PDF Takeover"
  61. $StopEdgePDFTakeover.width = 161
  62. $StopEdgePDFTakeover.height = 38
  63. $StopEdgePDFTakeover.location = New-Object System.Drawing.Point(130, 217)
  64. $StopEdgePDFTakeover.Font = 'Microsoft Sans Serif,10'
  65. $EnableEdgePDFTakeover = New-Object system.Windows.Forms.Button
  66. $EnableEdgePDFTakeover.text = "Enable Edge PDF Takeover"
  67. $EnableEdgePDFTakeover.width = 177
  68. $EnableEdgePDFTakeover.height = 39
  69. $EnableEdgePDFTakeover.location = New-Object System.Drawing.Point(130, 260)
  70. $EnableEdgePDFTakeover.Font = 'Microsoft Sans Serif,10'
  71. $DisableTelemetry = New-Object system.Windows.Forms.Button
  72. $DisableTelemetry.text = "Disable Telemetry/Tasks"
  73. $DisableTelemetry.width = 152
  74. $DisableTelemetry.height = 35
  75. $DisableTelemetry.location = New-Object System.Drawing.Point(9, 303)
  76. $DisableTelemetry.Font = 'Microsoft Sans Serif,10'
  77. $RemoveRegkeys = New-Object system.Windows.Forms.Button
  78. $RemoveRegkeys.text = "Remove Bloatware Regkeys"
  79. $RemoveRegkeys.width = 177
  80. $RemoveRegkeys.height = 40
  81. $RemoveRegkeys.location = New-Object System.Drawing.Point(169, 303)
  82. $RemoveRegkeys.Font = 'Microsoft Sans Serif,10'
  83. $RemoveOnedrive = New-Object system.Windows.Forms.Button
  84. $RemoveOnedrive.text = "Uninstall OneDrive"
  85. $RemoveOnedrive.width = 117
  86. $RemoveOnedrive.height = 35
  87. $RemoveOnedrive.location = New-Object System.Drawing.Point(9, 345)
  88. $RemoveOnedrive.Font = 'Microsoft Sans Serif,10'
  89. $FixWhitelist = New-Object system.Windows.Forms.Button
  90. $FixWhitelist.text = "Fix Whitelisted Apps"
  91. $FixWhitelist.width = 130
  92. $FixWhitelist.height = 37
  93. $FixWhitelist.location = New-Object System.Drawing.Point(254, 74)
  94. $FixWhitelist.Font = 'Microsoft Sans Serif,10'
  95. $RemoveBloatNoBlacklist = New-Object system.Windows.Forms.Button
  96. $RemoveBloatNoBlacklist.text = "Remove Bloatware Without Blacklist"
  97. $RemoveBloatNoBlacklist.width = 223
  98. $RemoveBloatNoBlacklist.height = 39
  99. $RemoveBloatNoBlacklist.location = New-Object System.Drawing.Point(9, 123)
  100. $RemoveBloatNoBlacklist.Font = 'Microsoft Sans Serif,10'
  101. $Form.controls.AddRange(@($Debloat, $RemoveAllBloatware, $RemoveBlacklist, $Label1, $RevertChange, $Label2, $DisableCortana, $EnableCortana, $StopEdgePDFTakeover, $EnableEdgePDFTakeover, $DisableTelemetry, $RemoveRegkeys, $RemoveOnedrive, $FixWhitelist, $RemoveBloatNoBlacklist))
  102. #region gui events {
  103. $RemoveBlacklist.Add_Click( {
  104. $ErrorActionPreference = 'silentlycontinue'
  105. Function DebloatBlacklist {
  106. [CmdletBinding()]
  107. Param ()
  108. $Bloatware = @(
  109. #Unnecessary Windows 10 AppX Apps
  110. "Microsoft.BingNews"
  111. "Microsoft.DesktopAppInstaller"
  112. "Microsoft.GetHelp"
  113. "Microsoft.Getstarted"
  114. "Microsoft.Messaging"
  115. "Microsoft.Microsoft3DViewer"
  116. "Microsoft.MicrosoftOfficeHub"
  117. "Microsoft.MicrosoftSolitaireCollection"
  118. "Microsoft.NetworkSpeedTest"
  119. "Microsoft.Office.OneNote"
  120. "Microsoft.Office.Sway"
  121. "Microsoft.OneConnect"
  122. "Microsoft.People"
  123. "Microsoft.Print3D"
  124. "Microsoft.RemoteDesktop"
  125. "Microsoft.SkypeApp"
  126. "Microsoft.StorePurchaseApp"
  127. "Microsoft.WindowsAlarms"
  128. "Microsoft.WindowsCamera"
  129. "microsoft.windowscommunicationsapps"
  130. "Microsoft.WindowsFeedbackHub"
  131. "Microsoft.WindowsMaps"
  132. "Microsoft.WindowsSoundRecorder"
  133. "Microsoft.Xbox.TCUI"
  134. "Microsoft.XboxApp"
  135. "Microsoft.XboxGameOverlay"
  136. "Microsoft.XboxIdentityProvider"
  137. "Microsoft.XboxSpeechToTextOverlay"
  138. "Microsoft.ZuneMusic"
  139. "Microsoft.ZuneVideo"
  140. #Sponsored Windows 10 AppX Apps
  141. #Add sponsored/featured apps to remove in the "*AppName*" format
  142. "*EclipseManager*"
  143. "*ActiproSoftwareLLC*"
  144. "*AdobeSystemsIncorporated.AdobePhotoshopExpress*"
  145. "*Duolingo-LearnLanguagesforFree*"
  146. "*PandoraMediaInc*"
  147. "*CandyCrush*"
  148. "*Wunderlist*"
  149. "*Flipboard*"
  150. "*Twitter*"
  151. "*Facebook*"
  152. "*Spotify*"
  153. "*Minecraft*"
  154. "*Royal Revolt*"
  155. #Optional: Typically not removed but you can if you need to for some reason
  156. #"*Microsoft.Advertising.Xaml_10.1712.5.0_x64__8wekyb3d8bbwe*"
  157. #"*Microsoft.Advertising.Xaml_10.1712.5.0_x86__8wekyb3d8bbwe*"
  158. #"*Microsoft.BingWeather*"
  159. #"*Microsoft.MSPaint*"
  160. #"*Microsoft.MicrosoftStickyNotes*"
  161. #"*Microsoft.Windows.Photos*"
  162. #"*Microsoft.WindowsCalculator*"
  163. #"*Microsoft.WindowsStore*"
  164. )
  165. foreach ($Bloat in $Bloatware) {
  166. Get-AppxPackage -Name $Bloat| Remove-AppxPackage -ErrorAction SilentlyContinue
  167. Get-AppxProvisionedPackage -Online | Where-Object DisplayName -like $Bloat | Remove-AppxProvisionedPackage -Online -ErrorAction SilentlyContinue
  168. Write-Host "Trying to remove $Bloat."
  169. Write-Host "Bloatware removed! `n"
  170. }
  171. }
  172. Write-Host "Removing Bloatware with a specific blacklist."
  173. DebloatBlacklist
  174. })
  175. $RemoveAllBloatware.Add_Click( {
  176. $ErrorActionPreference = 'silentlycontinue'
  177. #This function finds any AppX/AppXProvisioned package and uninstalls it, except for Freshpaint, Windows Calculator, Windows Store, and Windows Photos.
  178. #Also, to note - This does NOT remove essential system services/software/etc such as .NET framework installations, Cortana, Edge, etc.
  179. #This is the switch parameter for running this script as a 'silent' script, for use in MDT images or any type of mass deployment without user interaction.
  180. Function Begin-SysPrep {
  181. $ErrorActionPreference = 'silentlycontinue'
  182. Write-Host -Message ('Starting Sysprep Fixes')
  183. # Disable Windows Store Automatic Updates
  184. Write-Host -Message "Adding Registry key to Disable Windows Store Automatic Updates"
  185. $registryPath = "HKLM:\SOFTWARE\Policies\Microsoft\WindowsStore"
  186. If (!(Test-Path $registryPath)) {
  187. Mkdir $registryPath -ErrorAction SilentlyContinue
  188. New-ItemProperty $registryPath -Name AutoDownload -Value 2
  189. }
  190. Else {
  191. Set-ItemProperty $registryPath -Name AutoDownload -Value 2
  192. }
  193. #Stop WindowsStore Installer Service and set to Disabled
  194. Write-Host -Message ('Stopping InstallService')
  195. Stop-Service InstallService
  196. Write-Host -Message ('Setting InstallService Startup to Disabled')
  197. & Set-Service -Name InstallService -StartupType Disabled
  198. }
  199. Function DebloatAll {
  200. [CmdletBinding()]
  201. Param()
  202. #Removes AppxPackages
  203. #Credit to /u/GavinEke for a modified version of my whitelist code
  204. [regex]$WhitelistedApps = 'Microsoft.ScreenSketch|Microsoft.ScreenSketch|Microsoft.Paint3D|Microsoft.WindowsCalculator|Microsoft.WindowsStore|Microsoft.Windows.Photos|CanonicalGroupLimited.UbuntuonWindows|Microsoft.XboxGameCallableUI|Microsoft.XboxGamingOverlay|Microsoft.Xbox.TCUI|Microsoft.XboxGamingOverlay|Microsoft.XboxIdentityProvider|Microsoft.MicrosoftStickyNotes|Microsoft.MSPaint'
  205. Get-AppxPackage -AllUsers | Where-Object {$_.Name -NotMatch $WhitelistedApps} | Remove-AppxPackage
  206. Get-AppxPackage | Where-Object {$_.Name -NotMatch $WhitelistedApps} | Remove-AppxPackage
  207. Get-AppxProvisionedPackage -Online | Where-Object {$_.PackageName -NotMatch $WhitelistedApps} | Remove-AppxProvisionedPackage -Online
  208. }
  209. #Creates a PSDrive to be able to access the 'HKCR' tree
  210. New-PSDrive -Name HKCR -PSProvider Registry -Root HKEY_CLASSES_ROOT
  211. Function DebloatBlacklist {
  212. $ErrorActionPreference = 'silentlycontinue'
  213. $Bloatware = @(
  214. #Unnecessary Windows 10 AppX Apps
  215. "Microsoft.BingNews"
  216. "Microsoft.DesktopAppInstaller"
  217. "Microsoft.GetHelp"
  218. "Microsoft.Getstarted"
  219. "Microsoft.Messaging"
  220. "Microsoft.Microsoft3DViewer"
  221. "Microsoft.MicrosoftOfficeHub"
  222. "Microsoft.MicrosoftSolitaireCollection"
  223. "Microsoft.NetworkSpeedTest"
  224. "Microsoft.Office.OneNote"
  225. "Microsoft.Office.Sway"
  226. "Microsoft.OneConnect"
  227. "Microsoft.People"
  228. "Microsoft.Print3D"
  229. "Microsoft.RemoteDesktop"
  230. "Microsoft.SkypeApp"
  231. "Microsoft.StorePurchaseApp"
  232. "Microsoft.WindowsAlarms"
  233. "Microsoft.WindowsCamera"
  234. "microsoft.windowscommunicationsapps"
  235. "Microsoft.WindowsFeedbackHub"
  236. "Microsoft.WindowsMaps"
  237. "Microsoft.WindowsSoundRecorder"
  238. "Microsoft.Xbox.TCUI"
  239. "Microsoft.XboxApp"
  240. "Microsoft.XboxGameOverlay"
  241. "Microsoft.XboxIdentityProvider"
  242. "Microsoft.XboxSpeechToTextOverlay"
  243. "Microsoft.ZuneMusic"
  244. "Microsoft.ZuneVideo"
  245. #Sponsored Windows 10 AppX Apps
  246. #Add sponsored/featured apps to remove in the "*AppName*" format
  247. "*EclipseManager*"
  248. "*ActiproSoftwareLLC*"
  249. "*AdobeSystemsIncorporated.AdobePhotoshopExpress*"
  250. "*Duolingo-LearnLanguagesforFree*"
  251. "*PandoraMediaInc*"
  252. "*CandyCrush*"
  253. "*Wunderlist*"
  254. "*Flipboard*"
  255. "*Twitter*"
  256. "*Facebook*"
  257. "*Spotify*"
  258. "*Minecraft*"
  259. "*Royal Revolt*"
  260. #Optional: Typically not removed but you can if you need to for some reason
  261. #"*Microsoft.Advertising.Xaml_10.1712.5.0_x64__8wekyb3d8bbwe*"
  262. #"*Microsoft.Advertising.Xaml_10.1712.5.0_x86__8wekyb3d8bbwe*"
  263. #"*Microsoft.BingWeather*"
  264. #"*Microsoft.MSPaint*"
  265. #"*Microsoft.MicrosoftStickyNotes*"
  266. #"*Microsoft.Windows.Photos*"
  267. #"*Microsoft.WindowsCalculator*"
  268. #"*Microsoft.WindowsStore*"
  269. )
  270. foreach ($Bloat in $Bloatware) {
  271. Get-AppxPackage -Name $Bloat| Remove-AppxPackage -ErrorAction SilentlyContinue
  272. Get-AppxProvisionedPackage -Online | Where-Object DisplayName -like $Bloat | Remove-AppxProvisionedPackage -Online -ErrorAction SilentlyContinue
  273. Write-Host "Trying to remove $Bloat."
  274. }
  275. }
  276. Function Remove-Keys {
  277. $ErrorActionPreference = 'silentlycontinue'
  278. #These are the registry keys that it will delete.
  279. $Keys = @(
  280. #Remove Background Tasks
  281. "HKCR:\Extensions\ContractId\Windows.BackgroundTasks\PackageId\46928bounde.EclipseManager_2.2.4.51_neutral__a5h4egax66k6y"
  282. "HKCR:\Extensions\ContractId\Windows.BackgroundTasks\PackageId\ActiproSoftwareLLC.562882FEEB491_2.6.18.18_neutral__24pqs290vpjk0"
  283. "HKCR:\Extensions\ContractId\Windows.BackgroundTasks\PackageId\Microsoft.MicrosoftOfficeHub_17.7909.7600.0_x64__8wekyb3d8bbwe"
  284. "HKCR:\Extensions\ContractId\Windows.BackgroundTasks\PackageId\Microsoft.PPIProjection_10.0.15063.0_neutral_neutral_cw5n1h2txyewy"
  285. "HKCR:\Extensions\ContractId\Windows.BackgroundTasks\PackageId\Microsoft.XboxGameCallableUI_1000.15063.0.0_neutral_neutral_cw5n1h2txyewy"
  286. "HKCR:\Extensions\ContractId\Windows.BackgroundTasks\PackageId\Microsoft.XboxGameCallableUI_1000.16299.15.0_neutral_neutral_cw5n1h2txyewy"
  287. #Windows File
  288. "HKCR:\Extensions\ContractId\Windows.File\PackageId\ActiproSoftwareLLC.562882FEEB491_2.6.18.18_neutral__24pqs290vpjk0"
  289. #Registry keys to delete if they aren't uninstalled by RemoveAppXPackage/RemoveAppXProvisionedPackage
  290. "HKCR:\Extensions\ContractId\Windows.Launch\PackageId\46928bounde.EclipseManager_2.2.4.51_neutral__a5h4egax66k6y"
  291. "HKCR:\Extensions\ContractId\Windows.Launch\PackageId\ActiproSoftwareLLC.562882FEEB491_2.6.18.18_neutral__24pqs290vpjk0"
  292. "HKCR:\Extensions\ContractId\Windows.Launch\PackageId\Microsoft.PPIProjection_10.0.15063.0_neutral_neutral_cw5n1h2txyewy"
  293. "HKCR:\Extensions\ContractId\Windows.Launch\PackageId\Microsoft.XboxGameCallableUI_1000.15063.0.0_neutral_neutral_cw5n1h2txyewy"
  294. "HKCR:\Extensions\ContractId\Windows.Launch\PackageId\Microsoft.XboxGameCallableUI_1000.16299.15.0_neutral_neutral_cw5n1h2txyewy"
  295. #Scheduled Tasks to delete
  296. "HKCR:\Extensions\ContractId\Windows.PreInstalledConfigTask\PackageId\Microsoft.MicrosoftOfficeHub_17.7909.7600.0_x64__8wekyb3d8bbwe"
  297. #Windows Protocol Keys
  298. "HKCR:\Extensions\ContractId\Windows.Protocol\PackageId\ActiproSoftwareLLC.562882FEEB491_2.6.18.18_neutral__24pqs290vpjk0"
  299. "HKCR:\Extensions\ContractId\Windows.Protocol\PackageId\Microsoft.PPIProjection_10.0.15063.0_neutral_neutral_cw5n1h2txyewy"
  300. "HKCR:\Extensions\ContractId\Windows.Protocol\PackageId\Microsoft.XboxGameCallableUI_1000.15063.0.0_neutral_neutral_cw5n1h2txyewy"
  301. "HKCR:\Extensions\ContractId\Windows.Protocol\PackageId\Microsoft.XboxGameCallableUI_1000.16299.15.0_neutral_neutral_cw5n1h2txyewy"
  302. #Windows Share Target
  303. "HKCR:\Extensions\ContractId\Windows.ShareTarget\PackageId\ActiproSoftwareLLC.562882FEEB491_2.6.18.18_neutral__24pqs290vpjk0"
  304. )
  305. #This writes the output of each key it is removing and also removes the keys listed above.
  306. ForEach ($Key in $Keys) {
  307. Write-Host "Removing $Key from registry"
  308. Remove-Item $Key -Recurse -ErrorAction SilentlyContinue
  309. }
  310. }
  311. Function Protect-Privacy {
  312. $ErrorActionPreference = 'silentlycontinue'
  313. #Creates a PSDrive to be able to access the 'HKCR' tree
  314. New-PSDrive -Name HKCR -PSProvider Registry -Root HKEY_CLASSES_ROOT
  315. #Disables Windows Feedback Experience
  316. Write-Host "Disabling Windows Feedback Experience program"
  317. $Advertising = 'HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\AdvertisingInfo'
  318. If (Test-Path $Advertising) {
  319. Set-ItemProperty $Advertising -Name Enabled -Value 0 -Verbose
  320. }
  321. #Stops Cortana from being used as part of your Windows Search Function
  322. Write-Host "Stopping Cortana from being used as part of your Windows Search Function"
  323. $Search = 'HKLM:\SOFTWARE\Policies\Microsoft\Windows\Windows Search'
  324. If (Test-Path $Search) {
  325. Set-ItemProperty $Search -Name AllowCortana -Value 0 -Verbose
  326. }
  327. #Stops the Windows Feedback Experience from sending anonymous data
  328. Write-Host "Stopping the Windows Feedback Experience program"
  329. $Period1 = 'HKCU:\Software\Microsoft\Siuf'
  330. $Period2 = 'HKCU:\Software\Microsoft\Siuf\Rules'
  331. $Period3 = 'HKCU:\Software\Microsoft\Siuf\Rules\PeriodInNanoSeconds'
  332. If (!(Test-Path $Period3)) {
  333. mkdir $Period1 -ErrorAction SilentlyContinue
  334. mkdir $Period2 -ErrorAction SilentlyContinue
  335. mkdir $Period3 -ErrorAction SilentlyContinue
  336. New-ItemProperty $Period3 -Name PeriodInNanoSeconds -Value 0 -Verbose -ErrorAction SilentlyContinue
  337. }
  338. Write-Host "Adding Registry key to prevent bloatware apps from returning"
  339. #Prevents bloatware applications from returning
  340. $registryPath = "HKLM:\SOFTWARE\Policies\Microsoft\Windows\CloudContent"
  341. If (!(Test-Path $registryPath)) {
  342. Mkdir $registryPath -ErrorAction SilentlyContinue
  343. New-ItemProperty $registryPath -Name DisableWindowsConsumerFeatures -Value 1 -Verbose -ErrorAction SilentlyContinue
  344. }
  345. Write-Host "Setting Mixed Reality Portal value to 0 so that you can uninstall it in Settings"
  346. $Holo = 'HKCU:\Software\Microsoft\Windows\CurrentVersion\Holographic'
  347. If (Test-Path $Holo) {
  348. Set-ItemProperty $Holo -Name FirstRunSucceeded -Value 0 -Verbose
  349. }
  350. #Disables live tiles
  351. Write-Host "Disabling live tiles"
  352. $Live = 'HKCU:\SOFTWARE\Policies\Microsoft\Windows\CurrentVersion\PushNotifications'
  353. If (!(Test-Path $Live)) {
  354. mkdir $Live -ErrorAction SilentlyContinue
  355. New-ItemProperty $Live -Name NoTileApplicationNotification -Value 1 -Verbose
  356. }
  357. #Turns off Data Collection via the AllowTelemtry key by changing it to 0
  358. Write-Host "Turning off Data Collection"
  359. $DataCollection = 'HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\Policies\DataCollection'
  360. If (Test-Path $DataCollection) {
  361. Set-ItemProperty $DataCollection -Name AllowTelemetry -Value 0 -Verbose
  362. }
  363. #Disables People icon on Taskbar
  364. Write-Host "Disabling People icon on Taskbar"
  365. $People = 'HKCU:\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\Advanced\People'
  366. If (!(Test-Path $People)) {
  367. mkdir $People -ErrorAction SilentlyContinue
  368. New-ItemProperty $People -Name PeopleBand -Value 0 -Verbose
  369. }
  370. #Disables suggestions on start menu
  371. Write-Host "Disabling suggestions on the Start Menu"
  372. $Suggestions = 'HKCU:\Software\Microsoft\Windows\CurrentVersion\ContentDeliveryManager'
  373. If (Test-Path $Suggestions) {
  374. Set-ItemProperty $Suggestions -Name SystemPaneSuggestionsEnabled -Value 0 -Verbose
  375. }
  376. #Loads the registry keys/values below into the NTUSER.DAT file which prevents the apps from redownloading. Credit to a60wattfish
  377. reg load HKU\Default_User C:\Users\Default\NTUSER.DAT
  378. Set-ItemProperty -Path Registry::HKU\Default_User\SOFTWARE\Microsoft\Windows\CurrentVersion\ContentDeliveryManager -Name SystemPaneSuggestionsEnabled -Value 0
  379. Set-ItemProperty -Path Registry::HKU\Default_User\SOFTWARE\Microsoft\Windows\CurrentVersion\ContentDeliveryManager -Name PreInstalledAppsEnabled -Value 0
  380. Set-ItemProperty -Path Registry::HKU\Default_User\SOFTWARE\Microsoft\Windows\CurrentVersion\ContentDeliveryManager -Name OemPreInstalledAppsEnabled -Value 0
  381. reg unload HKU\Default_User
  382. #Disables scheduled tasks that are considered unnecessary
  383. Write-Host "Disabling scheduled tasks"
  384. #Get-ScheduledTask -TaskName XblGameSaveTaskLogon | Disable-ScheduledTask -ErrorAction SilentlyContinue
  385. Get-ScheduledTask -TaskName XblGameSaveTask | Disable-ScheduledTask -ErrorAction SilentlyContinue
  386. Get-ScheduledTask -TaskName Consolidator | Disable-ScheduledTask -ErrorAction SilentlyContinue
  387. Get-ScheduledTask -TaskName UsbCeip | Disable-ScheduledTask -ErrorAction SilentlyContinue
  388. Get-ScheduledTask -TaskName DmClient | Disable-ScheduledTask -ErrorAction SilentlyContinue
  389. Get-ScheduledTask -TaskName DmClientOnScenarioDownload | Disable-ScheduledTask -ErrorAction SilentlyContinue
  390. }
  391. #This includes fixes by xsisbest
  392. Function FixWhitelistedApps {
  393. $ErrorActionPreference = 'silentlycontinue'
  394. If (!(Get-AppxPackage -AllUsers | Select Microsoft.Paint3D, Microsoft.MSPaint, Microsoft.WindowsCalculator, Microsoft.WindowsStore, Microsoft.MicrosoftStickyNotes, Microsoft.WindowsSoundRecorder, Microsoft.Windows.Photos)) {
  395. #Credit to abulgatz for the 4 lines of code
  396. Get-AppxPackage -allusers Microsoft.Paint3D | Foreach {Add-AppxPackage -DisableDevelopmentMode -Register "$($_.InstallLocation)\AppXManifest.xml"}
  397. Get-AppxPackage -allusers Microsoft.MSPaint | Foreach {Add-AppxPackage -DisableDevelopmentMode -Register "$($_.InstallLocation)\AppXManifest.xml"}
  398. Get-AppxPackage -allusers Microsoft.WindowsCalculator | Foreach {Add-AppxPackage -DisableDevelopmentMode -Register "$($_.InstallLocation)\AppXManifest.xml"}
  399. Get-AppxPackage -allusers Microsoft.WindowsStore | Foreach {Add-AppxPackage -DisableDevelopmentMode -Register "$($_.InstallLocation)\AppXManifest.xml"}
  400. Get-AppxPackage -allusers Microsoft.MicrosoftStickyNotes | Foreach {Add-AppxPackage -DisableDevelopmentMode -Register "$($_.InstallLocation)\AppXManifest.xml"}
  401. Get-AppxPackage -allusers Microsoft.WindowsSoundRecorder | Foreach {Add-AppxPackage -DisableDevelopmentMode -Register "$($_.InstallLocation)\AppXManifest.xml"}
  402. Get-AppxPackage -allusers Microsoft.Windows.Photos | Foreach {Add-AppxPackage -DisableDevelopmentMode -Register "$($_.InstallLocation)\AppXManifest.xml"}
  403. }
  404. }
  405. Function CheckService {
  406. If (Get-Service -Name dmwappushservice | Where-Object {$_.Status -eq "Stopped"}) {
  407. Start-Service -Name dmwappushservice
  408. }
  409. }
  410. Function CheckInstallService {
  411. If (Get-Service -Name InstallService | Where-Object ($_.Status -eq "Stopped"}) {
  412. Start-Service -Name InstallService
  413. Set-Service -Name InstallService -StartupType Automatic
  414. }
  415. }
  416. Write-Host "Initiating Sysprep"
  417. Begin-SysPrep
  418. Write-Host "Removing bloatware apps."
  419. DebloatAll
  420. DebloatBlacklist
  421. Write-Host "Removing leftover bloatware registry keys."
  422. Remove-Keys
  423. Write-Host "Checking to see if any Whitelisted Apps were removed, and if so re-adding them."
  424. FixWhitelistedApps
  425. Write-Host "Stopping telemetry, disabling unneccessary scheduled tasks, and preventing bloatware from returning."
  426. Protect-Privacy
  427. #Write-Host "Stopping Edge from taking over as the default PDF Viewer."
  428. #Stop-EdgePDF
  429. Write-Output "Setting the 'InstallService' Windows service back to "Started" and the Startup Type "Automatic".
  430. CheckInstallService
  431. Write-Host "Finished all tasks. `n"
  432. } )
  433. $RemoveBloatNoBlacklist.Add_Click( {
  434. $ErrorActionPreference = 'silentlycontinue'
  435. #This function finds any AppX/AppXProvisioned package and uninstalls it, except for Freshpaint, Windows Calculator, Windows Store, and Windows Photos.
  436. #Also, to note - This does NOT remove essential system services/software/etc such as .NET framework installations, Cortana, Edge, etc.
  437. #This is the switch parameter for running this script as a 'silent' script, for use in MDT images or any type of mass deployment without user interaction.
  438. param (
  439. [switch]$Debloat, [switch]$SysPrep
  440. )
  441. Function Begin-SysPrep {
  442. $ErrorActionPreference = 'silentlycontinue'
  443. param([switch]$SysPrep)
  444. Write-Host -Message ('Starting Sysprep Fixes')
  445. # Disable Windows Store Automatic Updates
  446. Write-Host -Message "Adding Registry key to Disable Windows Store Automatic Updates"
  447. $registryPath = "HKLM:\SOFTWARE\Policies\Microsoft\WindowsStore"
  448. If (!(Test-Path $registryPath)) {
  449. Mkdir $registryPath -ErrorAction SilentlyContinue
  450. New-ItemProperty $registryPath -Name AutoDownload -Value 2
  451. }
  452. Else {
  453. Set-ItemProperty $registryPath -Name AutoDownload -Value 2
  454. }
  455. #Stop WindowsStore Installer Service and set to Disabled
  456. Write-Host -Message ('Stopping InstallService')
  457. Stop-Service InstallService
  458. Write-Host -Message ('Setting InstallService Startup to Disabled')
  459. & Set-Service -Name InstallService -StartupType Disabled
  460. }
  461. #Creates a PSDrive to be able to access the 'HKCR' tree
  462. New-PSDrive -Name HKCR -PSProvider Registry -Root HKEY_CLASSES_ROOT
  463. Function Start-Debloat {
  464. $ErrorActionPreference = 'silentlycontinue'
  465. param([switch]$Debloat)
  466. #Removes AppxPackages
  467. #Credit to Reddit user /u/GavinEke for a modified version of my whitelist code
  468. [regex]$WhitelistedApps = 'Microsoft.ScreenSketch|Microsoft.Paint3D|Microsoft.MSPaint|Microsoft.WindowsCalculator|Microsoft.WindowsStore|Microsoft.MicrosoftStickyNotes|Microsoft.WindowsSoundRecorder|Microsoft.Windows.Photos|CanonicalGroupLimited.UbuntuonWindows'
  469. Get-AppxPackage -AllUsers | Where-Object {$_.Name -NotMatch $WhitelistedApps} | Remove-AppxPackage -ErrorAction SilentlyContinue
  470. # Run this again to avoid error on 1803 or having to reboot.
  471. Get-AppxPackage -AllUsers | Where-Object {$_.Name -NotMatch $WhitelistedApps} | Remove-AppxPackage -ErrorAction SilentlyContinue
  472. Get-AppxProvisionedPackage -Online | Where-Object {$_.PackageName -NotMatch $WhitelistedApps} | Remove-AppxProvisionedPackage -Online -ErrorAction SilentlyContinue
  473. }
  474. Function Remove-Keys {
  475. $ErrorActionPreference = 'silentlycontinue'
  476. Param([switch]$Debloat)
  477. #These are the registry keys that it will delete.
  478. $Keys = @(
  479. #Remove Background Tasks
  480. "HKCR:\Extensions\ContractId\Windows.BackgroundTasks\PackageId\46928bounde.EclipseManager_2.2.4.51_neutral__a5h4egax66k6y"
  481. "HKCR:\Extensions\ContractId\Windows.BackgroundTasks\PackageId\ActiproSoftwareLLC.562882FEEB491_2.6.18.18_neutral__24pqs290vpjk0"
  482. "HKCR:\Extensions\ContractId\Windows.BackgroundTasks\PackageId\Microsoft.MicrosoftOfficeHub_17.7909.7600.0_x64__8wekyb3d8bbwe"
  483. "HKCR:\Extensions\ContractId\Windows.BackgroundTasks\PackageId\Microsoft.PPIProjection_10.0.15063.0_neutral_neutral_cw5n1h2txyewy"
  484. "HKCR:\Extensions\ContractId\Windows.BackgroundTasks\PackageId\Microsoft.XboxGameCallableUI_1000.15063.0.0_neutral_neutral_cw5n1h2txyewy"
  485. "HKCR:\Extensions\ContractId\Windows.BackgroundTasks\PackageId\Microsoft.XboxGameCallableUI_1000.16299.15.0_neutral_neutral_cw5n1h2txyewy"
  486. #Windows File
  487. "HKCR:\Extensions\ContractId\Windows.File\PackageId\ActiproSoftwareLLC.562882FEEB491_2.6.18.18_neutral__24pqs290vpjk0"
  488. #Registry keys to delete if they aren't uninstalled by RemoveAppXPackage/RemoveAppXProvisionedPackage
  489. "HKCR:\Extensions\ContractId\Windows.Launch\PackageId\46928bounde.EclipseManager_2.2.4.51_neutral__a5h4egax66k6y"
  490. "HKCR:\Extensions\ContractId\Windows.Launch\PackageId\ActiproSoftwareLLC.562882FEEB491_2.6.18.18_neutral__24pqs290vpjk0"
  491. "HKCR:\Extensions\ContractId\Windows.Launch\PackageId\Microsoft.PPIProjection_10.0.15063.0_neutral_neutral_cw5n1h2txyewy"
  492. "HKCR:\Extensions\ContractId\Windows.Launch\PackageId\Microsoft.XboxGameCallableUI_1000.15063.0.0_neutral_neutral_cw5n1h2txyewy"
  493. "HKCR:\Extensions\ContractId\Windows.Launch\PackageId\Microsoft.XboxGameCallableUI_1000.16299.15.0_neutral_neutral_cw5n1h2txyewy"
  494. #Scheduled Tasks to delete
  495. "HKCR:\Extensions\ContractId\Windows.PreInstalledConfigTask\PackageId\Microsoft.MicrosoftOfficeHub_17.7909.7600.0_x64__8wekyb3d8bbwe"
  496. #Windows Protocol Keys
  497. "HKCR:\Extensions\ContractId\Windows.Protocol\PackageId\ActiproSoftwareLLC.562882FEEB491_2.6.18.18_neutral__24pqs290vpjk0"
  498. "HKCR:\Extensions\ContractId\Windows.Protocol\PackageId\Microsoft.PPIProjection_10.0.15063.0_neutral_neutral_cw5n1h2txyewy"
  499. "HKCR:\Extensions\ContractId\Windows.Protocol\PackageId\Microsoft.XboxGameCallableUI_1000.15063.0.0_neutral_neutral_cw5n1h2txyewy"
  500. "HKCR:\Extensions\ContractId\Windows.Protocol\PackageId\Microsoft.XboxGameCallableUI_1000.16299.15.0_neutral_neutral_cw5n1h2txyewy"
  501. #Windows Share Target
  502. "HKCR:\Extensions\ContractId\Windows.ShareTarget\PackageId\ActiproSoftwareLLC.562882FEEB491_2.6.18.18_neutral__24pqs290vpjk0"
  503. )
  504. #This writes the output of each key it is removing and also removes the keys listed above.
  505. ForEach ($Key in $Keys) {
  506. Write-Host "Removing $Key from registry"
  507. Remove-Item $Key -Recurse -ErrorAction SilentlyContinue
  508. }
  509. }
  510. Function Protect-Privacy {
  511. $ErrorActionPreference = 'silentlycontinue'
  512. Param([switch]$Debloat)
  513. #Creates a PSDrive to be able to access the 'HKCR' tree
  514. New-PSDrive -Name HKCR -PSProvider Registry -Root HKEY_CLASSES_ROOT
  515. #Disables Windows Feedback Experience
  516. Write-Host "Disabling Windows Feedback Experience program"
  517. $Advertising = 'HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\AdvertisingInfo'
  518. If (Test-Path $Advertising) {
  519. Set-ItemProperty $Advertising -Name Enabled -Value 0 -Verbose
  520. }
  521. #Stops Cortana from being used as part of your Windows Search Function
  522. Write-Host "Stopping Cortana from being used as part of your Windows Search Function"
  523. $Search = 'HKLM:\SOFTWARE\Policies\Microsoft\Windows\Windows Search'
  524. If (Test-Path $Search) {
  525. Set-ItemProperty $Search -Name AllowCortana -Value 0 -Verbose
  526. }
  527. #Stops the Windows Feedback Experience from sending anonymous data
  528. Write-Host "Stopping the Windows Feedback Experience program"
  529. $Period1 = 'HKCU:\Software\Microsoft\Siuf'
  530. $Period2 = 'HKCU:\Software\Microsoft\Siuf\Rules'
  531. $Period3 = 'HKCU:\Software\Microsoft\Siuf\Rules\PeriodInNanoSeconds'
  532. If (!(Test-Path $Period3)) {
  533. mkdir $Period1 -ErrorAction SilentlyContinue
  534. mkdir $Period2 -ErrorAction SilentlyContinue
  535. mkdir $Period3 -ErrorAction SilentlyContinue
  536. New-ItemProperty $Period3 -Name PeriodInNanoSeconds -Value 0 -Verbose -ErrorAction SilentlyContinue
  537. }
  538. Write-Host "Adding Registry key to prevent bloatware apps from returning"
  539. #Prevents bloatware applications from returning
  540. $registryPath = "HKLM:\SOFTWARE\Policies\Microsoft\Windows\CloudContent"
  541. If (!(Test-Path $registryPath)) {
  542. Mkdir $registryPath -ErrorAction SilentlyContinue
  543. New-ItemProperty $registryPath -Name DisableWindowsConsumerFeatures -Value 1 -Verbose -ErrorAction SilentlyContinue
  544. }
  545. Write-Host "Setting Mixed Reality Portal value to 0 so that you can uninstall it in Settings"
  546. $Holo = 'HKCU:\Software\Microsoft\Windows\CurrentVersion\Holographic'
  547. If (Test-Path $Holo) {
  548. Set-ItemProperty $Holo -Name FirstRunSucceeded -Value 0 -Verbose
  549. }
  550. #Disables live tiles
  551. Write-Host "Disabling live tiles"
  552. $Live = 'HKCU:\SOFTWARE\Policies\Microsoft\Windows\CurrentVersion\PushNotifications'
  553. If (!(Test-Path $Live)) {
  554. mkdir $Live -ErrorAction SilentlyContinue
  555. New-ItemProperty $Live -Name NoTileApplicationNotification -Value 1 -Verbose
  556. }
  557. #Turns off Data Collection via the AllowTelemtry key by changing it to 0
  558. Write-Host "Turning off Data Collection"
  559. $DataCollection = 'HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\Policies\DataCollection'
  560. If (Test-Path $DataCollection) {
  561. Set-ItemProperty $DataCollection -Name AllowTelemetry -Value 0 -Verbose
  562. }
  563. #Disables People icon on Taskbar
  564. Write-Host "Disabling People icon on Taskbar"
  565. $People = 'HKCU:\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\Advanced\People'
  566. If (!(Test-Path $People)) {
  567. mkdir $People -ErrorAction SilentlyContinue
  568. New-ItemProperty $People -Name PeopleBand -Value 0 -Verbose
  569. }
  570. #Disables suggestions on start menu
  571. Write-Host "Disabling suggestions on the Start Menu"
  572. $Suggestions = 'HKCU:\Software\Microsoft\Windows\CurrentVersion\ContentDeliveryManager'
  573. If (Test-Path $Suggestions) {
  574. Set-ItemProperty $Suggestions -Name SystemPaneSuggestionsEnabled -Value 0 -Verbose
  575. }
  576. #Loads the registry keys/values below into the NTUSER.DAT file which prevents the apps from redownloading. Credit to a60wattfish
  577. reg load HKU\Default_User C:\Users\Default\NTUSER.DAT
  578. Set-ItemProperty -Path Registry::HKU\Default_User\SOFTWARE\Microsoft\Windows\CurrentVersion\ContentDeliveryManager -Name SystemPaneSuggestionsEnabled -Value 0
  579. Set-ItemProperty -Path Registry::HKU\Default_User\SOFTWARE\Microsoft\Windows\CurrentVersion\ContentDeliveryManager -Name PreInstalledAppsEnabled -Value 0
  580. Set-ItemProperty -Path Registry::HKU\Default_User\SOFTWARE\Microsoft\Windows\CurrentVersion\ContentDeliveryManager -Name OemPreInstalledAppsEnabled -Value 0
  581. reg unload HKU\Default_User
  582. #Disables scheduled tasks that are considered unnecessary
  583. Write-Host "Disabling scheduled tasks"
  584. #Get-ScheduledTask -TaskName XblGameSaveTaskLogon | Disable-ScheduledTask -ErrorAction SilentlyContinue
  585. Get-ScheduledTask -TaskName XblGameSaveTask | Disable-ScheduledTask -ErrorAction SilentlyContinue
  586. Get-ScheduledTask -TaskName Consolidator | Disable-ScheduledTask -ErrorAction SilentlyContinue
  587. Get-ScheduledTask -TaskName UsbCeip | Disable-ScheduledTask -ErrorAction SilentlyContinue
  588. Get-ScheduledTask -TaskName DmClient | Disable-ScheduledTask -ErrorAction SilentlyContinue
  589. Get-ScheduledTask -TaskName DmClientOnScenarioDownload | Disable-ScheduledTask -ErrorAction SilentlyContinue
  590. }
  591. #This includes fixes by xsisbest
  592. Function FixWhitelistedApps {
  593. Param([switch]$Debloat)
  594. If (!(Get-AppxPackage -AllUsers | Select Microsoft.Paint3D, Microsoft.MSPaint, Microsoft.WindowsCalculator, Microsoft.WindowsStore, Microsoft.MicrosoftStickyNotes, Microsoft.WindowsSoundRecorder, Microsoft.Windows.Photos)) {
  595. #Credit to abulgatz for the 4 lines of code
  596. Get-AppxPackage -allusers Microsoft.Paint3D | Foreach {Add-AppxPackage -DisableDevelopmentMode -Register "$($_.InstallLocation)\AppXManifest.xml"}
  597. Get-AppxPackage -allusers Microsoft.MSPaint | Foreach {Add-AppxPackage -DisableDevelopmentMode -Register "$($_.InstallLocation)\AppXManifest.xml"}
  598. Get-AppxPackage -allusers Microsoft.WindowsCalculator | Foreach {Add-AppxPackage -DisableDevelopmentMode -Register "$($_.InstallLocation)\AppXManifest.xml"}
  599. Get-AppxPackage -allusers Microsoft.WindowsStore | Foreach {Add-AppxPackage -DisableDevelopmentMode -Register "$($_.InstallLocation)\AppXManifest.xml"}
  600. Get-AppxPackage -allusers Microsoft.MicrosoftStickyNotes | Foreach {Add-AppxPackage -DisableDevelopmentMode -Register "$($_.InstallLocation)\AppXManifest.xml"}
  601. Get-AppxPackage -allusers Microsoft.WindowsSoundRecorder | Foreach {Add-AppxPackage -DisableDevelopmentMode -Register "$($_.InstallLocation)\AppXManifest.xml"}
  602. Get-AppxPackage -allusers Microsoft.Windows.Photos | Foreach {Add-AppxPackage -DisableDevelopmentMode -Register "$($_.InstallLocation)\AppXManifest.xml"}
  603. }
  604. }
  605. Function CheckService {
  606. Param([switch]$Debloat)
  607. If (Get-Service -Name dmwappushservice | Where-Object {$_.Status -eq "Stopped"}) {
  608. Start-Service -Name dmwappushservice
  609. }
  610. }
  611. Begin-SysPrep
  612. Write-Host "Removing bloatware apps."
  613. Start-Debloat
  614. Write-Host "Removing leftover bloatware registry keys."
  615. Remove-Keys
  616. Write-Host "Checking to see if any Whitelisted Apps were removed, and if so re-adding them."
  617. FixWhitelistedApps
  618. Write-Host "Stopping telemetry, disabling unneccessary scheduled tasks, and preventing bloatware from returning."
  619. Protect-Privacy
  620. #Write-Host "Stopping Edge from taking over as the default PDF Viewer."
  621. Write-Host "Checking to make sure that the service 'dmwappushservice' has been started."
  622. CheckService
  623. Write-Host "Finished all tasks. `n"
  624. })
  625. $RevertChange.Add_Click( {
  626. $ErrorActionPreference = 'silentlycontinue'
  627. #This function will revert the changes you made when running the Start-Debloat function.
  628. #This line reinstalls all of the bloatware that was removed
  629. Get-AppxPackage -AllUsers | ForEach {Add-AppxPackage -Verbose -DisableDevelopmentMode -Register "$($_.InstallLocation)\AppXManifest.xml"}
  630. #Tells Windows to enable your advertising information.
  631. Write-Host "Re-enabling key to show advertisement information"
  632. $Advertising = "HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\AdvertisingInfo"
  633. If (Test-Path $Advertising) {
  634. Set-ItemProperty $Advertising Enabled -Value 1
  635. }
  636. #Enables Cortana to be used as part of your Windows Search Function
  637. Write-Host "Re-enabling Cortana to be used in your Windows Search"
  638. $Search = "HKLM:\SOFTWARE\Policies\Microsoft\Windows\Windows Search"
  639. If (Test-Path $Search) {
  640. Set-ItemProperty $Search AllowCortana -Value 1
  641. }
  642. #Re-enables the Windows Feedback Experience for sending anonymous data
  643. Write-Host "Re-enabling Windows Feedback Experience"
  644. $Period = "HKCU:\Software\Microsoft\Siuf\Rules"
  645. If (!(Test-Path $Period)) {
  646. New-Item $Period
  647. }
  648. Set-ItemProperty $Period PeriodInNanoSeconds -Value 1
  649. #Enables bloatware applications
  650. Write-Host "Adding Registry key to allow bloatware apps to return"
  651. $registryPath = "HKLM:\SOFTWARE\Policies\Microsoft\Windows\CloudContent"
  652. If (!(Test-Path $registryPath)) {
  653. New-Item $registryPath
  654. }
  655. Set-ItemProperty $registryPath DisableWindowsConsumerFeatures -Value 0
  656. #Changes Mixed Reality Portal Key 'FirstRunSucceeded' to 1
  657. Write-Host "Setting Mixed Reality Portal value to 1"
  658. $Holo = "HKCU:\Software\Microsoft\Windows\CurrentVersion\Holographic"
  659. If (Test-Path $Holo) {
  660. Set-ItemProperty $Holo FirstRunSucceeded -Value 1
  661. }
  662. #Re-enables live tiles
  663. Write-Host "Enabling live tiles"
  664. $Live = "HKCU:\SOFTWARE\Policies\Microsoft\Windows\CurrentVersion\PushNotifications"
  665. If (!(Test-Path $Live)) {
  666. New-Item $Live
  667. }
  668. Set-ItemProperty $Live NoTileApplicationNotification -Value 0
  669. #Re-enables data collection
  670. Write-Host "Re-enabling data collection"
  671. $DataCollection = "HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\Policies\DataCollection"
  672. If (!(Test-Path $DataCollection)) {
  673. New-Item $DataCollection
  674. }
  675. Set-ItemProperty $DataCollection AllowTelemetry -Value 1
  676. #Re-enables People Icon on Taskbar
  677. Write-Host "Enabling People icon on Taskbar"
  678. $People = "HKCU:\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\Advanced\People"
  679. If (!(Test-Path $People)) {
  680. New-Item $People
  681. }
  682. Set-ItemProperty $People PeopleBand -Value 1
  683. #Re-enables suggestions on start menu
  684. Write-Host "Enabling suggestions on the Start Menu"
  685. $Suggestions = "HKCU:\Software\Microsoft\Windows\CurrentVersion\ContentDeliveryManager"
  686. If (!(Test-Path $Suggestions)) {
  687. New-Item $Suggestions
  688. }
  689. Set-ItemProperty $Suggestions SystemPaneSuggestionsEnabled -Value 1
  690. #Re-enables scheduled tasks that were disabled when running the Debloat switch
  691. Write-Host "Enabling scheduled tasks that were disabled"
  692. Get-ScheduledTask XblGameSaveTaskLogon | Enable-ScheduledTask
  693. Get-ScheduledTask XblGameSaveTask | Enable-ScheduledTask
  694. Get-ScheduledTask Consolidator | Enable-ScheduledTask
  695. Get-ScheduledTask UsbCeip | Enable-ScheduledTask
  696. Get-ScheduledTask DmClient | Enable-ScheduledTask
  697. Get-ScheduledTask DmClientOnScenarioDownload | Enable-ScheduledTask
  698. Write-Host "Re-enabling and starting WAP Push Service"
  699. #Enable and start WAP Push Service
  700. Set-Service "dmwappushservice" -StartupType Automatic
  701. Start-Service "dmwappushservice"
  702. Write-Host "Re-enabling and starting the Diagnostics Tracking Service"
  703. #Enabling the Diagnostics Tracking Service
  704. Set-Service "DiagTrack" -StartupType Automatic
  705. Start-Service "DiagTrack"
  706. Write-Host "Done reverting changes! `n"
  707. })
  708. $FixWhitelist.Add_Click( {
  709. $ErrorActionPreference = 'silentlycontinue'
  710. If (!(Get-AppxPackage -AllUsers | Select Microsoft.Paint3D, Microsoft.WindowsCalculator, Microsoft.WindowsStore, Microsoft.Windows.Photos)) {
  711. #Credit to abulgatz for these 4 lines of code
  712. Get-AppxPackage -allusers Microsoft.Paint3D | Foreach {Add-AppxPackage -DisableDevelopmentMode -Register "$($_.InstallLocation)\AppXManifest.xml"}
  713. Get-AppxPackage -allusers Microsoft.WindowsCalculator | Foreach {Add-AppxPackage -DisableDevelopmentMode -Register "$($_.InstallLocation)\AppXManifest.xml"}
  714. Get-AppxPackage -allusers Microsoft.WindowsStore | Foreach {Add-AppxPackage -DisableDevelopmentMode -Register "$($_.InstallLocation)\AppXManifest.xml"}
  715. Get-AppxPackage -allusers Microsoft.Windows.Photos | Foreach {Add-AppxPackage -DisableDevelopmentMode -Register "$($_.InstallLocation)\AppXManifest.xml"}
  716. }
  717. Write-Host "Whitelisted apps were either fixed or re-added. `n"
  718. })
  719. $DisableCortana.Add_Click( {
  720. $ErrorActionPreference = 'silentlycontinue'
  721. Write-Host "Disabling Cortana"
  722. $Cortana1 = "HKCU:\SOFTWARE\Microsoft\Personalization\Settings"
  723. $Cortana2 = "HKCU:\SOFTWARE\Microsoft\InputPersonalization"
  724. $Cortana3 = "HKCU:\SOFTWARE\Microsoft\InputPersonalization\TrainedDataStore"
  725. If (!(Test-Path $Cortana1)) {
  726. New-Item $Cortana1
  727. }
  728. Set-ItemProperty $Cortana1 AcceptedPrivacyPolicy -Value 0
  729. If (!(Test-Path $Cortana2)) {
  730. New-Item $Cortana2
  731. }
  732. Set-ItemProperty $Cortana2 RestrictImplicitTextCollection -Value 1
  733. Set-ItemProperty $Cortana2 RestrictImplicitInkCollection -Value 1
  734. If (!(Test-Path $Cortana3)) {
  735. New-Item $Cortana3
  736. }
  737. Set-ItemProperty $Cortana3 HarvestContacts -Value 0
  738. Write-Host "Cortana has been disabled. `n"
  739. })
  740. $StopEdgePDFTakeover.Add_Click( {
  741. $ErrorActionPreference = 'silentlycontinue'
  742. #Stops edge from taking over as the default .PDF viewer
  743. Write-Host "Stopping Edge from taking over as the default .PDF viewer"
  744. $NoPDF = "HKCR:\.pdf"
  745. $NoProgids = "HKCR:\.pdf\OpenWithProgids"
  746. $NoWithList = "HKCR:\.pdf\OpenWithList"
  747. If (!(Get-ItemProperty $NoPDF NoOpenWith)) {
  748. New-ItemProperty $NoPDF NoOpenWith
  749. }
  750. If (!(Get-ItemProperty $NoPDF NoStaticDefaultVerb)) {
  751. New-ItemProperty $NoPDF NoStaticDefaultVerb
  752. }
  753. If (!(Get-ItemProperty $NoProgids NoOpenWith)) {
  754. New-ItemProperty $NoProgids NoOpenWith
  755. }
  756. If (!(Get-ItemProperty $NoProgids NoStaticDefaultVerb)) {
  757. New-ItemProperty $NoProgids NoStaticDefaultVerb
  758. }
  759. If (!(Get-ItemProperty $NoWithList NoOpenWith)) {
  760. New-ItemProperty $NoWithList NoOpenWith
  761. }
  762. If (!(Get-ItemProperty $NoWithList NoStaticDefaultVerb)) {
  763. New-ItemProperty $NoWithList NoStaticDefaultVerb
  764. }
  765. #Appends an underscore '_' to the Registry key for Edge
  766. $Edge = "HKCR:\AppXd4nrz8ff68srnhf9t5a8sbjyar1cr723_"
  767. If (Test-Path $Edge) {
  768. Set-Item $Edge AppXd4nrz8ff68srnhf9t5a8sbjyar1cr723_
  769. }
  770. Write-Host "Edge should no longer take over as the default .PDF. `n"
  771. })
  772. $EnableCortana.Add_Click( {
  773. $ErrorActionPreference = 'silentlycontinue'
  774. Write-Host "Re-enabling Cortana"
  775. $Cortana1 = "HKCU:\SOFTWARE\Microsoft\Personalization\Settings"
  776. $Cortana2 = "HKCU:\SOFTWARE\Microsoft\InputPersonalization"
  777. $Cortana3 = "HKCU:\SOFTWARE\Microsoft\InputPersonalization\TrainedDataStore"
  778. If (!(Test-Path $Cortana1)) {
  779. New-Item $Cortana1
  780. }
  781. Set-ItemProperty $Cortana1 AcceptedPrivacyPolicy -Value 1
  782. If (!(Test-Path $Cortana2)) {
  783. New-Item $Cortana2
  784. }
  785. Set-ItemProperty $Cortana2 RestrictImplicitTextCollection -Value 0
  786. Set-ItemProperty $Cortana2 RestrictImplicitInkCollection -Value 0
  787. If (!(Test-Path $Cortana3)) {
  788. New-Item $Cortana3
  789. }
  790. Set-ItemProperty $Cortana3 HarvestContacts -Value 1
  791. Write-Host "Cortana has been enabled! `n"
  792. })
  793. $EnableEdgePDFTakeover.Add_Click( {
  794. New-PSDrive HKCR -PSProvider Registry -Root HKEY_CLASSES_ROOT
  795. $ErrorActionPreference = 'silentlycontinue'
  796. Write-Host "Setting Edge back to default"
  797. $NoPDF = "HKCR:\.pdf"
  798. $NoProgids = "HKCR:\.pdf\OpenWithProgids"
  799. $NoWithList = "HKCR:\.pdf\OpenWithList"
  800. #Sets edge back to default
  801. If (Get-ItemProperty $NoPDF NoOpenWith) {
  802. Remove-ItemProperty $NoPDF NoOpenWith
  803. }
  804. If (Get-ItemProperty $NoPDF NoStaticDefaultVerb) {
  805. Remove-ItemProperty $NoPDF NoStaticDefaultVerb
  806. }
  807. If (Get-ItemProperty $NoProgids NoOpenWith) {
  808. Remove-ItemProperty $NoProgids NoOpenWith
  809. }
  810. If (Get-ItemProperty $NoProgids NoStaticDefaultVerb) {
  811. Remove-ItemProperty $NoProgids NoStaticDefaultVerb
  812. }
  813. If (Get-ItemProperty $NoWithList NoOpenWith) {
  814. Remove-ItemProperty $NoWithList NoOpenWith
  815. }
  816. If (Get-ItemProperty $NoWithList NoStaticDefaultVerb) {
  817. Remove-ItemProperty $NoWithList NoStaticDefaultVerb
  818. }
  819. #Removes an underscore '_' from the Registry key for Edge
  820. $Edge2 = "HKCR:\AppXd4nrz8ff68srnhf9t5a8sbjyar1cr723_"
  821. If (Test-Path $Edge2) {
  822. Set-Item $Edge2 AppXd4nrz8ff68srnhf9t5a8sbjyar1cr723
  823. }
  824. Write-Host "Edge will now be able to be used for .PDF. `n"
  825. })
  826. $DisableTelemetry.Add_Click( {
  827. $ErrorActionPreference = 'silentlycontinue'
  828. #Disables Windows Feedback Experience
  829. Write-Host "Disabling Windows Feedback Experience program"
  830. $Advertising = "HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\AdvertisingInfo"
  831. If (Test-Path $Advertising) {
  832. Set-ItemProperty $Advertising Enabled -Value 0
  833. }
  834. #Stops Cortana from being used as part of your Windows Search Function
  835. Write-Host "Stopping Cortana from being used as part of your Windows Search Function"
  836. $Search = "HKLM:\SOFTWARE\Policies\Microsoft\Windows\Windows Search"
  837. If (Test-Path $Search) {
  838. Set-ItemProperty $Search AllowCortana -Value 0
  839. }
  840. #Disables Web Search in Start Menu
  841. Write-Host "Disabling Bing Search in Start Menu"
  842. $WebSearch = "HKLM:\SOFTWARE\Policies\Microsoft\Windows\Windows Search"
  843. Set-ItemProperty "HKCU:\SOFTWARE\Microsoft\Windows\CurrentVersion\Search" BingSearchEnabled -Value 0
  844. If (!(Test-Path $WebSearch)) {
  845. New-Item $WebSearch
  846. }
  847. Set-ItemProperty $WebSearch DisableWebSearch -Value 1
  848. #Stops the Windows Feedback Experience from sending anonymous data
  849. Write-Host "Stopping the Windows Feedback Experience program"
  850. $Period = "HKCU:\Software\Microsoft\Siuf\Rules"
  851. If (!(Test-Path $Period)) {
  852. New-Item $Period
  853. }
  854. Set-ItemProperty $Period PeriodInNanoSeconds -Value 0
  855. #Prevents bloatware applications from returning and removes Start Menu suggestions
  856. Write-Host "Adding Registry key to prevent bloatware apps from returning"
  857. $registryPath = "HKLM:\SOFTWARE\Policies\Microsoft\Windows\CloudContent"
  858. $registryOEM = "HKCU:\SOFTWARE\Microsoft\Windows\CurrentVersion\ContentDeliveryManager"
  859. If (!(Test-Path $registryPath)) {
  860. New-Item $registryPath
  861. }
  862. Set-ItemProperty $registryPath DisableWindowsConsumerFeatures -Value 1
  863. If (!(Test-Path $registryOEM)) {
  864. New-Item $registryOEM
  865. }
  866. Set-ItemProperty $registryOEM ContentDeliveryAllowed -Value 0
  867. Set-ItemProperty $registryOEM OemPreInstalledAppsEnabled -Value 0
  868. Set-ItemProperty $registryOEM PreInstalledAppsEnabled -Value 0
  869. Set-ItemProperty $registryOEM PreInstalledAppsEverEnabled -Value 0
  870. Set-ItemProperty $registryOEM SilentInstalledAppsEnabled -Value 0
  871. Set-ItemProperty $registryOEM SystemPaneSuggestionsEnabled -Value 0
  872. #Preping mixed Reality Portal for removal
  873. Write-Host "Setting Mixed Reality Portal value to 0 so that you can uninstall it in Settings"
  874. $Holo = "HKCU:\Software\Microsoft\Windows\CurrentVersion\Holographic"
  875. If (Test-Path $Holo) {
  876. Set-ItemProperty $Holo FirstRunSucceeded -Value 0
  877. }
  878. #Disables Wi-fi Sense
  879. Write-Host "Disabling Wi-Fi Sense"
  880. $WifiSense1 = "HKLM:\SOFTWARE\Microsoft\PolicyManager\default\WiFi\AllowWiFiHotSpotReporting"
  881. $WifiSense2 = "HKLM:\SOFTWARE\Microsoft\PolicyManager\default\WiFi\AllowAutoConnectToWiFiSenseHotspots"
  882. $WifiSense3 = "HKLM:\SOFTWARE\Microsoft\WcmSvc\wifinetworkmanager\config"
  883. If (!(Test-Path $WifiSense1)) {
  884. New-Item $WifiSense1
  885. }
  886. Set-ItemProperty $WifiSense1 Value -Value 0
  887. If (!(Test-Path $WifiSense2)) {
  888. New-Item $WifiSense2
  889. }
  890. Set-ItemProperty $WifiSense2 Value -Value 0
  891. Set-ItemProperty $WifiSense3 AutoConnectAllowedOEM -Value 0
  892. #Disables live tiles
  893. Write-Host "Disabling live tiles"
  894. $Live = "HKCU:\SOFTWARE\Policies\Microsoft\Windows\CurrentVersion\PushNotifications"
  895. If (!(Test-Path $Live)) {
  896. New-Item $Live
  897. }
  898. Set-ItemProperty $Live NoTileApplicationNotification -Value 1
  899. #Turns off Data Collection via the AllowTelemtry key by changing it to 0
  900. Write-Host "Turning off Data Collection"
  901. $DataCollection1 = "HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\Policies\DataCollection"
  902. $DataCollection2 = "HKLM:\SOFTWARE\Policies\Microsoft\Windows\DataCollection"
  903. $DataCollection3 = "HKLM:\SOFTWARE\Wow6432Node\Microsoft\Windows\CurrentVersion\Policies\DataCollection"
  904. If (Test-Path $DataCollection1) {
  905. Set-ItemProperty $DataCollection1 AllowTelemetry -Value 0
  906. }
  907. If (Test-Path $DataCollection2) {
  908. Set-ItemProperty $DataCollection2 AllowTelemetry -Value 0
  909. }
  910. If (Test-Path $DataCollection3) {
  911. Set-ItemProperty $DataCollection3 AllowTelemetry -Value 0
  912. }
  913. #Disabling Location Tracking
  914. Write-Host "Disabling Location Tracking"
  915. $SensorState = "HKLM:\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Sensor\Overrides\{BFA794E4-F964-4FDB-90F6-51056BFE4B44}"
  916. $LocationConfig = "HKLM:\SYSTEM\CurrentControlSet\Services\lfsvc\Service\Configuration"
  917. If (!(Test-Path $SensorState)) {
  918. New-Item $SensorState
  919. }
  920. Set-ItemProperty $SensorState SensorPermissionState -Value 0
  921. If (!(Test-Path $LocationConfig)) {
  922. New-Item $LocationConfig
  923. }
  924. Set-ItemProperty $LocationConfig Status -Value 0
  925. #Disables People icon on Taskbar
  926. Write-Host "Disabling People icon on Taskbar"
  927. $People = "HKCU:\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\Advanced\People"
  928. If (!(Test-Path $People)) {
  929. New-Item $People
  930. }
  931. Set-ItemProperty $People PeopleBand -Value 0
  932. #Disables scheduled tasks that are considered unnecessary
  933. Write-Host "Disabling scheduled tasks"
  934. Get-ScheduledTask XblGameSaveTaskLogon | Disable-ScheduledTask
  935. Get-ScheduledTask XblGameSaveTask | Disable-ScheduledTask
  936. Get-ScheduledTask Consolidator | Disable-ScheduledTask
  937. Get-ScheduledTask UsbCeip | Disable-ScheduledTask
  938. Get-ScheduledTask DmClient | Disable-ScheduledTask
  939. Get-ScheduledTask DmClientOnScenarioDownload | Disable-ScheduledTask
  940. #Write-Host "Uninstalling Telemetry Windows Updates"
  941. #Uninstalls Some Windows Updates considered to be Telemetry. !WIP!
  942. #Wusa /Uninstall /KB:3022345 /norestart /quiet
  943. #Wusa /Uninstall /KB:3068708 /norestart /quiet
  944. #Wusa /Uninstall /KB:3075249 /norestart /quiet
  945. #Wusa /Uninstall /KB:3080149 /norestart /quiet
  946. Write-Host "Stopping and disabling WAP Push Service"
  947. #Stop and disable WAP Push Service
  948. Stop-Service "dmwappushservice"
  949. Set-Service "dmwappushservice" -StartupType Disabled
  950. Write-Host "Stopping and disabling Diagnostics Tracking Service"
  951. #Disabling the Diagnostics Tracking Service
  952. Stop-Service "DiagTrack"
  953. Set-Service "DiagTrack" -StartupType Disabled
  954. Write-Host "Telemetry has been disabled! `n"
  955. })
  956. $RemoveRegkeys.Add_Click( {
  957. $ErrorActionPreference = 'silentlycontinue'
  958. $Keys = @(
  959. New-PSDrive HKCR -PSProvider Registry -Root HKEY_CLASSES_ROOT
  960. #Remove Background Tasks
  961. "HKCR:\Extensions\ContractId\Windows.BackgroundTasks\PackageId\46928bounde.EclipseManager_2.2.4.51_neutral__a5h4egax66k6y"
  962. "HKCR:\Extensions\ContractId\Windows.BackgroundTasks\PackageId\ActiproSoftwareLLC.562882FEEB491_2.6.18.18_neutral__24pqs290vpjk0"
  963. "HKCR:\Extensions\ContractId\Windows.BackgroundTasks\PackageId\Microsoft.MicrosoftOfficeHub_17.7909.7600.0_x64__8wekyb3d8bbwe"
  964. "HKCR:\Extensions\ContractId\Windows.BackgroundTasks\PackageId\Microsoft.PPIProjection_10.0.15063.0_neutral_neutral_cw5n1h2txyewy"
  965. "HKCR:\Extensions\ContractId\Windows.BackgroundTasks\PackageId\Microsoft.XboxGameCallableUI_1000.15063.0.0_neutral_neutral_cw5n1h2txyewy"
  966. "HKCR:\Extensions\ContractId\Windows.BackgroundTasks\PackageId\Microsoft.XboxGameCallableUI_1000.16299.15.0_neutral_neutral_cw5n1h2txyewy"
  967. #Windows File
  968. "HKCR:\Extensions\ContractId\Windows.File\PackageId\ActiproSoftwareLLC.562882FEEB491_2.6.18.18_neutral__24pqs290vpjk0"
  969. #Registry keys to delete if they aren't uninstalled by RemoveAppXPackage/RemoveAppXProvisionedPackage
  970. "HKCR:\Extensions\ContractId\Windows.Launch\PackageId\46928bounde.EclipseManager_2.2.4.51_neutral__a5h4egax66k6y"
  971. "HKCR:\Extensions\ContractId\Windows.Launch\PackageId\ActiproSoftwareLLC.562882FEEB491_2.6.18.18_neutral__24pqs290vpjk0"
  972. "HKCR:\Extensions\ContractId\Windows.Launch\PackageId\Microsoft.PPIProjection_10.0.15063.0_neutral_neutral_cw5n1h2txyewy"
  973. "HKCR:\Extensions\ContractId\Windows.Launch\PackageId\Microsoft.XboxGameCallableUI_1000.15063.0.0_neutral_neutral_cw5n1h2txyewy"
  974. "HKCR:\Extensions\ContractId\Windows.Launch\PackageId\Microsoft.XboxGameCallableUI_1000.16299.15.0_neutral_neutral_cw5n1h2txyewy"
  975. #Scheduled Tasks to delete
  976. "HKCR:\Extensions\ContractId\Windows.PreInstalledConfigTask\PackageId\Microsoft.MicrosoftOfficeHub_17.7909.7600.0_x64__8wekyb3d8bbwe"
  977. #Windows Protocol Keys
  978. "HKCR:\Extensions\ContractId\Windows.Protocol\PackageId\ActiproSoftwareLLC.562882FEEB491_2.6.18.18_neutral__24pqs290vpjk0"
  979. "HKCR:\Extensions\ContractId\Windows.Protocol\PackageId\Microsoft.PPIProjection_10.0.15063.0_neutral_neutral_cw5n1h2txyewy"
  980. "HKCR:\Extensions\ContractId\Windows.Protocol\PackageId\Microsoft.XboxGameCallableUI_1000.15063.0.0_neutral_neutral_cw5n1h2txyewy"
  981. "HKCR:\Extensions\ContractId\Windows.Protocol\PackageId\Microsoft.XboxGameCallableUI_1000.16299.15.0_neutral_neutral_cw5n1h2txyewy"
  982. #Windows Share Target
  983. "HKCR:\Extensions\ContractId\Windows.ShareTarget\PackageId\ActiproSoftwareLLC.562882FEEB491_2.6.18.18_neutral__24pqs290vpjk0"
  984. )
  985. #This writes the output of each key it is removing and also removes the keys listed above.
  986. ForEach ($Key in $Keys) {
  987. Write-Host "Removing $Key from registry"
  988. Remove-Item $Key -Recurse
  989. }
  990. Write-Host "Additional bloatware keys have been removed! `n"
  991. })
  992. $RemoveOnedrive.Add_Click( {
  993. Write-Host "Uninstalling OneDrive. Please wait..."
  994. New-PSDrive HKCR -PSProvider Registry -Root HKEY_CLASSES_ROOT
  995. $onedrive = "$env:SYSTEMROOT\SysWOW64\OneDriveSetup.exe"
  996. $ExplorerReg1 = "HKCR:\CLSID\{018D5C66-4533-4307-9B53-224DE2ED1FE6}"
  997. $ExplorerReg2 = "HKCR:\Wow6432Node\CLSID\{018D5C66-4533-4307-9B53-224DE2ED1FE6}"
  998. Stop-Process -Name "OneDrive*"
  999. Start-Sleep 2
  1000. If (!(Test-Path $onedrive)) {
  1001. $onedrive = "$env:SYSTEMROOT\System32\OneDriveSetup.exe"
  1002. }
  1003. Start-Process $onedrive "/uninstall" -NoNewWindow -Wait
  1004. Start-Sleep 2
  1005. Write-Host "Stopping explorer"
  1006. Start-Sleep 1
  1007. .\taskkill.exe /F /IM explorer.exe
  1008. Start-Sleep 3
  1009. Write-Host "Removing leftover files"
  1010. Remove-Item "$env:USERPROFILE\OneDrive" -Force -Recurse
  1011. Remove-Item "$env:LOCALAPPDATA\Microsoft\OneDrive" -Force -Recurse
  1012. Remove-Item "$env:PROGRAMDATA\Microsoft OneDrive" -Force -Recurse
  1013. If (Test-Path "$env:SYSTEMDRIVE\OneDriveTemp") {
  1014. Remove-Item "$env:SYSTEMDRIVE\OneDriveTemp" -Force -Recurse
  1015. }
  1016. Write-Host "Removing OneDrive from windows explorer"
  1017. If (!(Test-Path $ExplorerReg1)) {
  1018. New-Item $ExplorerReg1
  1019. }
  1020. Set-ItemProperty $ExplorerReg1 System.IsPinnedToNameSpaceTree -Value 0
  1021. If (!(Test-Path $ExplorerReg2)) {
  1022. New-Item $ExplorerReg2
  1023. }
  1024. Set-ItemProperty $ExplorerReg2 System.IsPinnedToNameSpaceTree -Value 0
  1025. Write-Host "Restarting Explorer that was shut down before."
  1026. Start-Process explorer.exe -NoNewWindow
  1027. Write-Host "OneDrive has been successfully uninstalled! `n"
  1028. })
  1029. #endregion events }
  1030. #endregion GUI }
  1031. [void]$Form.ShowDialog()