Windows10DebloaterGUI.ps1 69 KB

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