Windows10DebloaterGUI.ps1 67 KB

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