Windows10DebloaterGUI.ps1 62 KB

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