Windows10DebloaterGUI.ps1 69 KB

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