Windows10DebloaterGUI.ps1 66 KB

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