Windows10DebloaterGUI.ps1 71 KB

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