Windows10DebloaterGUI.ps1 69 KB

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