Windows10DebloaterGUI.ps1 73 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455
  1. <#
  2. $EnableEdgePDFTakeover.Text = "Enable Edge PDF Takeover"
  3. $EnableEdgePDFTakeover.Width = 185
  4. $EnableEdgePDFTakeover.Height = 35
  5. $EnableEdgePDFTakeover.Location = New-Object System.Drawing.Point(155, 260)
  6. #>
  7. #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.
  8. $ErrorActionPreference = 'SilentlyContinue'
  9. $Button = [System.Windows.MessageBoxButton]::YesNoCancel
  10. $ErrorIco = [System.Windows.MessageBoxImage]::Error
  11. $Ask = 'Do you want to run this as an Administrator?
  12. Select "Yes" to Run as an Administrator
  13. Select "No" to not run this as an Administrator
  14. Select "Cancel" to stop the script.'
  15. If (!([Security.Principal.WindowsPrincipal][Security.Principal.WindowsIdentity]::GetCurrent()).IsInRole([Security.Principal.WindowsBuiltInRole]'Administrator')) {
  16. $Prompt = [System.Windows.MessageBox]::Show($Ask, "Run as an Administrator or not?", $Button, $ErrorIco)
  17. Switch ($Prompt) {
  18. #This will debloat Windows 10
  19. Yes {
  20. Write-Host "You didn't run this script as an Administrator. This script will self elevate to run as an Administrator and continue."
  21. Start-Process PowerShell.exe -ArgumentList ("-NoProfile -ExecutionPolicy Bypass -File `"{0}`"" -f $PSCommandPath) -Verb RunAs
  22. Exit
  23. }
  24. No {
  25. Break
  26. }
  27. }
  28. }
  29. #Unnecessary Windows 10 AppX apps that will be removed by the blacklist.
  30. $global:Bloatware = @(
  31. "Microsoft.PPIProjection"
  32. "Microsoft.BingNews"
  33. "Microsoft.GetHelp"
  34. "Microsoft.Getstarted"
  35. "Microsoft.Messaging"
  36. "Microsoft.Microsoft3DViewer"
  37. "Microsoft.MicrosoftOfficeHub"
  38. "Microsoft.MicrosoftSolitaireCollection"
  39. "Microsoft.NetworkSpeedTest"
  40. "Microsoft.News" # Issue 77
  41. "Microsoft.Office.Lens" # Issue 77
  42. "Microsoft.Office.OneNote"
  43. "Microsoft.Office.Sway"
  44. "Microsoft.OneConnect"
  45. "Microsoft.People"
  46. "Microsoft.Print3D"
  47. "Microsoft.RemoteDesktop" # Issue 120
  48. "Microsoft.SkypeApp"
  49. "Microsoft.StorePurchaseApp"
  50. "Microsoft.Office.Todo.List" # Issue 77
  51. "Microsoft.Whiteboard" # Issue 77
  52. "Microsoft.WindowsAlarms"
  53. "microsoft.windowscommunicationsapps"
  54. "Microsoft.WindowsFeedbackHub"
  55. "Microsoft.WindowsMaps"
  56. "Microsoft.WindowsSoundRecorder"
  57. "Microsoft.Xbox.TCUI"
  58. "Microsoft.XboxApp"
  59. "Microsoft.XboxGameOverlay"
  60. "Microsoft.XboxGamingOverlay"
  61. "Microsoft.XboxIdentityProvider"
  62. "Microsoft.XboxSpeechToTextOverlay"
  63. "Microsoft.ZuneMusic"
  64. "Microsoft.ZuneVideo"
  65. #Sponsored Windows 10 AppX Apps
  66. #Add sponsored/featured apps to remove in the "*AppName*" format
  67. "EclipseManager"
  68. "ActiproSoftwareLLC"
  69. "AdobeSystemsIncorporated.AdobePhotoshopExpress"
  70. "Duolingo-LearnLanguagesforFree"
  71. "PandoraMediaInc"
  72. "CandyCrush"
  73. "BubbleWitch3Saga"
  74. "Wunderlist"
  75. "Flipboard"
  76. "Twitter"
  77. "Facebook"
  78. "Spotify" # Issue 123
  79. "Minecraft"
  80. "Royal Revolt"
  81. "Sway" # Issue 77
  82. "Dolby" # Issue 78
  83. #Optional: Typically not removed but you can if you need to for some reason
  84. #"Microsoft.Advertising.Xaml_10.1712.5.0_x64__8wekyb3d8bbwe"
  85. #"Microsoft.Advertising.Xaml_10.1712.5.0_x86__8wekyb3d8bbwe"
  86. #"Microsoft.BingWeather"
  87. )
  88. #Valuable Windows 10 AppX apps that most people want to keep. Protected from DeBloat All.
  89. #Credit to /u/GavinEke for a modified version of my whitelist code
  90. $global:WhiteListedApps = @(
  91. "Microsoft.WindowsCalculator" # Microsoft removed legacy calculator
  92. "Microsoft.WindowsStore" # Issue 1
  93. "Microsoft.Windows.Photos" # Microsoft disabled/hid legacy photo viewer
  94. "CanonicalGroupLimited.UbuntuonWindows" # Issue 10
  95. "Microsoft.Xbox.TCUI" # Issue 25, 91 Many home users want to play games
  96. "Microsoft.XboxApp"
  97. "Microsoft.XboxGameOverlay"
  98. "Microsoft.XboxGamingOverlay" # Issue 25, 91 Many home users want to play games
  99. "Microsoft.XboxIdentityProvider" # Issue 25, 91 Many home users want to play games
  100. "Microsoft.XboxSpeechToTextOverlay"
  101. "Microsoft.MicrosoftStickyNotes" # Issue 33 New functionality.
  102. "Microsoft.MSPaint" # Issue 32 This is Paint3D, legacy paint still exists in Windows 10
  103. "Microsoft.WindowsCamera" # Issue 65 New functionality.
  104. "\.NET"
  105. "Microsoft.HEIFImageExtension" # Issue 68
  106. "Microsoft.ScreenSketch" # Issue 55: Looks like Microsoft will be axing snipping tool and using Snip & Sketch going forward
  107. "Microsoft.StorePurchaseApp" # Issue 68
  108. "Microsoft.VP9VideoExtensions" # Issue 68
  109. "Microsoft.WebMediaExtensions" # Issue 68
  110. "Microsoft.WebpImageExtension" # Issue 68
  111. "Microsoft.DesktopAppInstaller" # Issue 68
  112. "WindSynthBerry" # Issue 68
  113. "MIDIBerry" # Issue 68
  114. "Slack" # Issue 83
  115. "*Nvidia*" # Issue 198
  116. "Microsoft.MixedReality.Portal" # Issue 195
  117. )
  118. #NonRemovable Apps that where getting attempted and the system would reject the uninstall, speeds up debloat and prevents 'initalizing' overlay when removing apps
  119. $NonRemovables = Get-AppxPackage -AllUsers | Where-Object { $_.NonRemovable -eq $true } | ForEach { $_.Name }
  120. $NonRemovables += Get-AppxPackage | Where-Object { $_.NonRemovable -eq $true } | ForEach { $_.Name }
  121. $NonRemovables += Get-AppxProvisionedPackage -Online | Where-Object { $_.NonRemovable -eq $true } | ForEach { $_.DisplayName }
  122. $NonRemovables = $NonRemovables | Sort-Object -Unique
  123. if ($NonRemovables -eq $null ) {
  124. # the .NonRemovable property doesn't exist until version 18xx. Use a hard-coded list instead.
  125. #WARNING: only use exact names here - no short names or wildcards
  126. $NonRemovables = @(
  127. "1527c705-839a-4832-9118-54d4Bd6a0c89"
  128. "c5e2524a-ea46-4f67-841f-6a9465d9d515"
  129. "E2A4F912-2574-4A75-9BB0-0D023378592B"
  130. "F46D4000-FD22-4DB4-AC8E-4E1DDDE828FE"
  131. "InputApp"
  132. "Microsoft.AAD.BrokerPlugin"
  133. "Microsoft.AccountsControl"
  134. "Microsoft.BioEnrollment"
  135. "Microsoft.CredDialogHost"
  136. "Microsoft.ECApp"
  137. "Microsoft.LockApp"
  138. "Microsoft.MicrosoftEdgeDevToolsClient"
  139. "Microsoft.MicrosoftEdge"
  140. "Microsoft.PPIProjection"
  141. "Microsoft.Win32WebViewHost"
  142. "Microsoft.Windows.Apprep.ChxApp"
  143. "Microsoft.Windows.AssignedAccessLockApp"
  144. "Microsoft.Windows.CapturePicker"
  145. "Microsoft.Windows.CloudExperienceHost"
  146. "Microsoft.Windows.ContentDeliveryManager"
  147. "Microsoft.Windows.Cortana"
  148. "Microsoft.Windows.HolographicFirstRun" # Added 1709
  149. "Microsoft.Windows.NarratorQuickStart"
  150. "Microsoft.Windows.OOBENetworkCaptivePortal" # Added 1709
  151. "Microsoft.Windows.OOBENetworkConnectionFlow" # Added 1709
  152. "Microsoft.Windows.ParentalControls"
  153. "Microsoft.Windows.PeopleExperienceHost"
  154. "Microsoft.Windows.PinningConfirmationDialog"
  155. "Microsoft.Windows.SecHealthUI" # Issue 117 Windows Defender
  156. "Microsoft.Windows.SecondaryTileExperience" # Added 1709
  157. "Microsoft.Windows.SecureAssessmentBrowser"
  158. "Microsoft.Windows.ShellExperienceHost"
  159. "Microsoft.Windows.XGpuEjectDialog"
  160. "Microsoft.XboxGameCallableUI" # Issue 91
  161. "Windows.CBSPreview"
  162. "windows.immersivecontrolpanel"
  163. "Windows.PrintDialog"
  164. "Microsoft.VCLibs.140.00"
  165. "Microsoft.Services.Store.Engagement"
  166. "Microsoft.UI.Xaml.2.0"
  167. )
  168. }
  169. # import library code - located relative to this script
  170. Function dotInclude() {
  171. Param(
  172. [Parameter(Mandatory)]
  173. [string]$includeFile
  174. )
  175. # Look for the file in the same directory as this script
  176. $scriptPath = $PSScriptRoot
  177. if ( $PSScriptRoot -eq $null -and $psISE) {
  178. $scriptPath = (Split-Path -Path $psISE.CurrentFile.FullPath)
  179. }
  180. if ( test-path $scriptPath\$includeFile ) {
  181. # import and immediately execute the requested file
  182. . $scriptPath\$includeFile
  183. }
  184. }
  185. # Override built-in blacklist/whitelist with user defined lists
  186. dotInclude 'custom-lists.ps1'
  187. #convert to regular expression to allow for the super-useful -match operator
  188. $global:BloatwareRegex = $global:Bloatware -join '|'
  189. $global:WhiteListedAppsRegex = $global:WhiteListedApps -join '|'
  190. # This form was created using POSHGUI.com a free online gui designer for PowerShell
  191. Add-Type -AssemblyName System.Windows.Forms
  192. [System.Windows.Forms.Application]::EnableVisualStyles()
  193. $Form = New-Object system.Windows.Forms.Form
  194. $Form.ClientSize = New-Object System.Drawing.Point(500,570)
  195. $Form.StartPosition = 'CenterScreen'
  196. $Form.FormBorderStyle = 'FixedSingle'
  197. $Form.MinimizeBox = $false
  198. $Form.MaximizeBox = $false
  199. $Form.ShowIcon = $false
  200. $Form.text = "Windows10Debloader"
  201. $Form.TopMost = $false
  202. $Form.BackColor = [System.Drawing.ColorTranslator]::FromHtml("#252525")
  203. $DebloatPanel = New-Object system.Windows.Forms.Panel
  204. $DebloatPanel.height = 160
  205. $DebloatPanel.width = 480
  206. $DebloatPanel.Anchor = 'top,right,left'
  207. $DebloatPanel.location = New-Object System.Drawing.Point(10,10)
  208. $RegistryPanel = New-Object system.Windows.Forms.Panel
  209. $RegistryPanel.height = 80
  210. $RegistryPanel.width = 480
  211. $RegistryPanel.Anchor = 'top,right,left'
  212. $RegistryPanel.location = New-Object System.Drawing.Point(10,180)
  213. $CortanaPanel = New-Object system.Windows.Forms.Panel
  214. $CortanaPanel.height = 120
  215. $CortanaPanel.width = 153
  216. $CortanaPanel.Anchor = 'top,right,left'
  217. $CortanaPanel.location = New-Object System.Drawing.Point(10,270)
  218. $EdgePanel = New-Object system.Windows.Forms.Panel
  219. $EdgePanel.height = 120
  220. $EdgePanel.width = 154
  221. $EdgePanel.Anchor = 'top,right,left'
  222. $EdgePanel.location = New-Object System.Drawing.Point(173,270)
  223. $DarkThemePanel = New-Object system.Windows.Forms.Panel
  224. $DarkThemePanel.height = 120
  225. $DarkThemePanel.width = 153
  226. $DarkThemePanel.Anchor = 'top,right,left'
  227. $DarkThemePanel.location = New-Object System.Drawing.Point(337,270)
  228. $OtherPanel = New-Object system.Windows.Forms.Panel
  229. $OtherPanel.height = 160
  230. $OtherPanel.width = 480
  231. $OtherPanel.Anchor = 'top,right,left'
  232. $OtherPanel.location = New-Object System.Drawing.Point(10,400)
  233. $Debloat = New-Object system.Windows.Forms.Label
  234. $Debloat.text = "DEBLOAT OPTIONS"
  235. $Debloat.AutoSize = $true
  236. $Debloat.width = 457
  237. $Debloat.height = 142
  238. $Debloat.Anchor = 'top,right,left'
  239. $Debloat.location = New-Object System.Drawing.Point(10,9)
  240. $Debloat.Font = New-Object System.Drawing.Font('Consolas',15,[System.Drawing.FontStyle]([System.Drawing.FontStyle]::Bold))
  241. $Debloat.ForeColor = [System.Drawing.ColorTranslator]::FromHtml("#eeeeee")
  242. $CustomizeBlacklist = New-Object system.Windows.Forms.Button
  243. $CustomizeBlacklist.FlatStyle = 'Flat'
  244. $CustomizeBlacklist.text = "CUSTOMISE BLACKLIST"
  245. $CustomizeBlacklist.width = 460
  246. $CustomizeBlacklist.height = 30
  247. $CustomizeBlacklist.Anchor = 'top,right,left'
  248. $CustomizeBlacklist.location = New-Object System.Drawing.Point(10,40)
  249. $CustomizeBlacklist.Font = New-Object System.Drawing.Font('Consolas',9)
  250. $CustomizeBlacklist.ForeColor = [System.Drawing.ColorTranslator]::FromHtml("#eeeeee")
  251. $RemoveAllBloatware = New-Object system.Windows.Forms.Button
  252. $RemoveAllBloatware.FlatStyle = 'Flat'
  253. $RemoveAllBloatware.text = "REMOVE ALL BLOATWARE"
  254. $RemoveAllBloatware.width = 460
  255. $RemoveAllBloatware.height = 30
  256. $RemoveAllBloatware.Anchor = 'top,right,left'
  257. $RemoveAllBloatware.location = New-Object System.Drawing.Point(10,80)
  258. $RemoveAllBloatware.Font = New-Object System.Drawing.Font('Consolas',9)
  259. $RemoveAllBloatware.ForeColor = [System.Drawing.ColorTranslator]::FromHtml("#eeeeee")
  260. $RemoveBlacklistedBloatware = New-Object system.Windows.Forms.Button
  261. $RemoveBlacklistedBloatware.FlatStyle = 'Flat'
  262. $RemoveBlacklistedBloatware.text = "REMOVE BLOATWARE WITH CUSTOM BLACKLIST"
  263. $RemoveBlacklistedBloatware.width = 460
  264. $RemoveBlacklistedBloatware.height = 30
  265. $RemoveBlacklistedBloatware.Anchor = 'top,right,left'
  266. $RemoveBlacklistedBloatware.location = New-Object System.Drawing.Point(10,120)
  267. $RemoveBlacklistedBloatware.Font = New-Object System.Drawing.Font('Consolas',9)
  268. $RemoveBlacklistedBloatware.ForeColor = [System.Drawing.ColorTranslator]::FromHtml("#eeeeee")
  269. $Registry = New-Object system.Windows.Forms.Label
  270. $Registry.text = "REGISTRY CHANGES"
  271. $Registry.AutoSize = $true
  272. $Registry.width = 457
  273. $Registry.height = 142
  274. $Registry.Anchor = 'top,right,left'
  275. $Registry.location = New-Object System.Drawing.Point(10,10)
  276. $Registry.Font = New-Object System.Drawing.Font('Consolas',15,[System.Drawing.FontStyle]([System.Drawing.FontStyle]::Bold))
  277. $Registry.ForeColor = [System.Drawing.ColorTranslator]::FromHtml("#eeeeee")
  278. $RevertChanges = New-Object system.Windows.Forms.Button
  279. $RevertChanges.FlatStyle = 'Flat'
  280. $RevertChanges.text = "REVERT REGISTRY CHANGES"
  281. $RevertChanges.width = 460
  282. $RevertChanges.height = 30
  283. $RevertChanges.Anchor = 'top,right,left'
  284. $RevertChanges.location = New-Object System.Drawing.Point(10,40)
  285. $RevertChanges.Font = New-Object System.Drawing.Font('Consolas',9)
  286. $RevertChanges.ForeColor = [System.Drawing.ColorTranslator]::FromHtml("#eeeeee")
  287. $Cortana = New-Object system.Windows.Forms.Label
  288. $Cortana.text = "CORTANA"
  289. $Cortana.AutoSize = $true
  290. $Cortana.width = 457
  291. $Cortana.height = 142
  292. $Cortana.Anchor = 'top,right,left'
  293. $Cortana.location = New-Object System.Drawing.Point(10,10)
  294. $Cortana.Font = New-Object System.Drawing.Font('Consolas',15,[System.Drawing.FontStyle]([System.Drawing.FontStyle]::Bold))
  295. $Cortana.ForeColor = [System.Drawing.ColorTranslator]::FromHtml("#eeeeee")
  296. $EnableCortana = New-Object system.Windows.Forms.Button
  297. $EnableCortana.FlatStyle = 'Flat'
  298. $EnableCortana.text = "ENABLE"
  299. $EnableCortana.width = 133
  300. $EnableCortana.height = 30
  301. $EnableCortana.Anchor = 'top,right,left'
  302. $EnableCortana.location = New-Object System.Drawing.Point(10,40)
  303. $EnableCortana.Font = New-Object System.Drawing.Font('Consolas',9)
  304. $EnableCortana.ForeColor = [System.Drawing.ColorTranslator]::FromHtml("#eeeeee")
  305. $DisableCortana = New-Object system.Windows.Forms.Button
  306. $DisableCortana.FlatStyle = 'Flat'
  307. $DisableCortana.text = "DISABLE"
  308. $DisableCortana.width = 133
  309. $DisableCortana.height = 30
  310. $DisableCortana.Anchor = 'top,right,left'
  311. $DisableCortana.location = New-Object System.Drawing.Point(10,80)
  312. $DisableCortana.Font = New-Object System.Drawing.Font('Consolas',9)
  313. $DisableCortana.ForeColor = [System.Drawing.ColorTranslator]::FromHtml("#eeeeee")
  314. $Edge = New-Object system.Windows.Forms.Label
  315. $Edge.text = "EDGE PDF"
  316. $Edge.AutoSize = $true
  317. $Edge.width = 457
  318. $Edge.height = 142
  319. $Edge.Anchor = 'top,right,left'
  320. $Edge.location = New-Object System.Drawing.Point(10,10)
  321. $Edge.Font = New-Object System.Drawing.Font('Consolas',15,[System.Drawing.FontStyle]([System.Drawing.FontStyle]::Bold))
  322. $Edge.ForeColor = [System.Drawing.ColorTranslator]::FromHtml("#eeeeee")
  323. $EnableEdgePDFTakeover = New-Object system.Windows.Forms.Button
  324. $EnableEdgePDFTakeover.FlatStyle = 'Flat'
  325. $EnableEdgePDFTakeover.text = "ENABLE"
  326. $EnableEdgePDFTakeover.width = 134
  327. $EnableEdgePDFTakeover.height = 30
  328. $EnableEdgePDFTakeover.Anchor = 'top,right,left'
  329. $EnableEdgePDFTakeover.location = New-Object System.Drawing.Point(10,40)
  330. $EnableEdgePDFTakeover.Font = New-Object System.Drawing.Font('Consolas',9)
  331. $EnableEdgePDFTakeover.ForeColor = [System.Drawing.ColorTranslator]::FromHtml("#eeeeee")
  332. $DisableEdgePDFTakeover = New-Object system.Windows.Forms.Button
  333. $DisableEdgePDFTakeover.FlatStyle = 'Flat'
  334. $DisableEdgePDFTakeover.text = "DISABLE"
  335. $DisableEdgePDFTakeover.width = 134
  336. $DisableEdgePDFTakeover.height = 30
  337. $DisableEdgePDFTakeover.Anchor = 'top,right,left'
  338. $DisableEdgePDFTakeover.location = New-Object System.Drawing.Point(10,80)
  339. $DisableEdgePDFTakeover.Font = New-Object System.Drawing.Font('Consolas',9)
  340. $DisableEdgePDFTakeover.ForeColor = [System.Drawing.ColorTranslator]::FromHtml("#eeeeee")
  341. $Theme = New-Object system.Windows.Forms.Label
  342. $Theme.text = "DARK THEME"
  343. $Theme.AutoSize = $true
  344. $Theme.width = 457
  345. $Theme.height = 142
  346. $Theme.Anchor = 'top,right,left'
  347. $Theme.location = New-Object System.Drawing.Point(10,10)
  348. $Theme.Font = New-Object System.Drawing.Font('Consolas',15,[System.Drawing.FontStyle]([System.Drawing.FontStyle]::Bold))
  349. $Theme.ForeColor = [System.Drawing.ColorTranslator]::FromHtml("#eeeeee")
  350. $EnableDarkMode = New-Object system.Windows.Forms.Button
  351. $EnableDarkMode.FlatStyle = 'Flat'
  352. $EnableDarkMode.text = "ENABLE"
  353. $EnableDarkMode.width = 133
  354. $EnableDarkMode.height = 30
  355. $EnableDarkMode.Anchor = 'top,right,left'
  356. $EnableDarkMode.location = New-Object System.Drawing.Point(10,40)
  357. $EnableDarkMode.Font = New-Object System.Drawing.Font('Consolas',9)
  358. $EnableDarkMode.ForeColor = [System.Drawing.ColorTranslator]::FromHtml("#eeeeee")
  359. $DisableDarkMode = New-Object system.Windows.Forms.Button
  360. $DisableDarkMode.FlatStyle = 'Flat'
  361. $DisableDarkMode.text = "DISABLE"
  362. $DisableDarkMode.width = 133
  363. $DisableDarkMode.height = 30
  364. $DisableDarkMode.Anchor = 'top,right,left'
  365. $DisableDarkMode.location = New-Object System.Drawing.Point(10,80)
  366. $DisableDarkMode.Font = New-Object System.Drawing.Font('Consolas',9)
  367. $DisableDarkMode.ForeColor = [System.Drawing.ColorTranslator]::FromHtml("#eeeeee")
  368. $Other = New-Object system.Windows.Forms.Label
  369. $Other.text = "OTHER CHANGES & FIXES"
  370. $Other.AutoSize = $true
  371. $Other.width = 457
  372. $Other.height = 142
  373. $Other.Anchor = 'top,right,left'
  374. $Other.location = New-Object System.Drawing.Point(10,10)
  375. $Other.Font = New-Object System.Drawing.Font('Consolas',15,[System.Drawing.FontStyle]([System.Drawing.FontStyle]::Bold))
  376. $Other.ForeColor = [System.Drawing.ColorTranslator]::FromHtml("#eeeeee")
  377. $RemoveOnedrive = New-Object system.Windows.Forms.Button
  378. $RemoveOnedrive.FlatStyle = 'Flat'
  379. $RemoveOnedrive.text = "UNINSTALL ONEDRIVE"
  380. $RemoveOnedrive.width = 225
  381. $RemoveOnedrive.height = 30
  382. $RemoveOnedrive.Anchor = 'top,right,left'
  383. $RemoveOnedrive.location = New-Object System.Drawing.Point(10,40)
  384. $RemoveOnedrive.Font = New-Object System.Drawing.Font('Consolas',9)
  385. $RemoveOnedrive.ForeColor = [System.Drawing.ColorTranslator]::FromHtml("#eeeeee")
  386. $UnpinStartMenuTiles = New-Object system.Windows.Forms.Button
  387. $UnpinStartMenuTiles.FlatStyle = 'Flat'
  388. $UnpinStartMenuTiles.text = "UNPIN TILES FROM START MENU"
  389. $UnpinStartMenuTiles.width = 225
  390. $UnpinStartMenuTiles.height = 30
  391. $UnpinStartMenuTiles.Anchor = 'top,right,left'
  392. $UnpinStartMenuTiles.location = New-Object System.Drawing.Point(245,40)
  393. $UnpinStartMenuTiles.Font = New-Object System.Drawing.Font('Consolas',9)
  394. $UnpinStartMenuTiles.ForeColor = [System.Drawing.ColorTranslator]::FromHtml("#eeeeee")
  395. $DisableTelemetry = New-Object system.Windows.Forms.Button
  396. $DisableTelemetry.FlatStyle = 'Flat'
  397. $DisableTelemetry.text = "DISABLE TELEMETRY / TASKS"
  398. $DisableTelemetry.width = 225
  399. $DisableTelemetry.height = 30
  400. $DisableTelemetry.Anchor = 'top,right,left'
  401. $DisableTelemetry.location = New-Object System.Drawing.Point(10,80)
  402. $DisableTelemetry.Font = New-Object System.Drawing.Font('Consolas',9)
  403. $DisableTelemetry.ForeColor = [System.Drawing.ColorTranslator]::FromHtml("#eeeeee")
  404. $RemoveRegkeys = New-Object system.Windows.Forms.Button
  405. $RemoveRegkeys.FlatStyle = 'Flat'
  406. $RemoveRegkeys.text = "REMOVE BLOATWARE REGKEYS"
  407. $RemoveRegkeys.width = 225
  408. $RemoveRegkeys.height = 30
  409. $RemoveRegkeys.Anchor = 'top,right,left'
  410. $RemoveRegkeys.location = New-Object System.Drawing.Point(245,80)
  411. $RemoveRegkeys.Font = New-Object System.Drawing.Font('Consolas',9)
  412. $RemoveRegkeys.ForeColor = [System.Drawing.ColorTranslator]::FromHtml("#eeeeee")
  413. $InstallNet35 = New-Object system.Windows.Forms.Button
  414. $InstallNet35.FlatStyle = 'Flat'
  415. $InstallNet35.text = "INSTALL .NET V3.5"
  416. $InstallNet35.width = 460
  417. $InstallNet35.height = 30
  418. $InstallNet35.Anchor = 'top,right,left'
  419. $InstallNet35.location = New-Object System.Drawing.Point(10,120)
  420. $InstallNet35.Font = New-Object System.Drawing.Font('Consolas',9)
  421. $InstallNet35.ForeColor = [System.Drawing.ColorTranslator]::FromHtml("#eeeeee")
  422. $Form.controls.AddRange(@($RegistryPanel,$DebloatPanel,$CortanaPanel,$EdgePanel,$DarkThemePanel,$OtherPanel))
  423. $DebloatPanel.controls.AddRange(@($Debloat,$CustomizeBlacklist,$RemoveAllBloatware,$RemoveBlacklistedBloatware))
  424. $RegistryPanel.controls.AddRange(@($Registry,$RevertChanges))
  425. $CortanaPanel.controls.AddRange(@($Cortana,$EnableCortana,$DisableCortana))
  426. $EdgePanel.controls.AddRange(@($EnableEdgePDFTakeover,$DisableEdgePDFTakeover,$Edge))
  427. $DarkThemePanel.controls.AddRange(@($Theme,$DisableDarkMode,$EnableDarkMode))
  428. $OtherPanel.controls.AddRange(@($Other,$RemoveOnedrive,$InstallNet35,$UnpinStartMenuTiles,$DisableTelemetry,$RemoveRegkeys))
  429. $DebloatFolder = "C:\Temp\Windows10Debloater"
  430. If (Test-Path $DebloatFolder) {
  431. Write-Host "${DebloatFolder} exists. Skipping."
  432. }
  433. Else {
  434. Write-Host "The folder ${DebloatFolder} doesn't exist. This folder will be used for storing logs created after the script runs. Creating now."
  435. Start-Sleep 1
  436. New-Item -Path "${DebloatFolder}" -ItemType Directory
  437. Write-Host "The folder ${DebloatFolder} was successfully created."
  438. }
  439. Start-Transcript -OutputDirectory "${DebloatFolder}"
  440. #region gui events {
  441. $CustomizeBlacklist.Add_Click( {
  442. $CustomizeForm = New-Object System.Windows.Forms.Form
  443. $CustomizeForm.ClientSize = New-Object System.Drawing.Point(500,570)
  444. $CustomizeForm.StartPosition = 'CenterScreen'
  445. $CustomizeForm.FormBorderStyle = 'FixedSingle'
  446. $CustomizeForm.MinimizeBox = $false
  447. $CustomizeForm.MaximizeBox = $false
  448. $CustomizeForm.ShowIcon = $false
  449. $CustomizeForm.Text = "Customize Whitelist and Blacklist"
  450. $CustomizeForm.TopMost = $false
  451. $CustomizeForm.AutoScroll = $false
  452. $CustomizeForm.BackColor = [System.Drawing.ColorTranslator]::FromHtml("#252525")
  453. $ListPanel = New-Object system.Windows.Forms.Panel
  454. $ListPanel.height = 510
  455. $ListPanel.width = 480
  456. $ListPanel.Anchor = 'top,right,left'
  457. $ListPanel.location = New-Object System.Drawing.Point(10,10)
  458. $ListPanel.AutoScroll = $true
  459. $ListPanel.BackColor = [System.Drawing.ColorTranslator]::FromHtml("#252525")
  460. $SaveList = New-Object System.Windows.Forms.Button
  461. $SaveList.FlatStyle = 'Flat'
  462. $SaveList.Text = "Save custom Whitelist and Blacklist to custom-lists.ps1"
  463. $SaveList.width = 480
  464. $SaveList.height = 30
  465. $SaveList.Location = New-Object System.Drawing.Point(10, 530)
  466. $SaveList.Font = New-Object System.Drawing.Font('Consolas',9)
  467. $SaveList.ForeColor = [System.Drawing.ColorTranslator]::FromHtml("#eeeeee")
  468. $CustomizeForm.controls.AddRange(@($SaveList,$ListPanel))
  469. $SaveList.Add_Click( {
  470. $ErrorActionPreference = 'SilentlyContinue'
  471. '$global:WhiteListedApps = @(' | Out-File -FilePath $PSScriptRoot\custom-lists.ps1 -Encoding utf8
  472. @($ListPanel.controls) | ForEach {
  473. if ($_ -is [System.Windows.Forms.CheckBox] -and $_.Enabled -and !$_.Checked) {
  474. " ""$( $_.Text )""" | Out-File -FilePath $PSScriptRoot\custom-lists.ps1 -Append -Encoding utf8
  475. }
  476. }
  477. ')' | Out-File -FilePath $PSScriptRoot\custom-lists.ps1 -Append -Encoding utf8
  478. '$global:Bloatware = @(' | Out-File -FilePath $PSScriptRoot\custom-lists.ps1 -Append -Encoding utf8
  479. @($ListPanel.controls) | ForEach {
  480. if ($_ -is [System.Windows.Forms.CheckBox] -and $_.Enabled -and $_.Checked) {
  481. " ""$($_.Text)""" | Out-File -FilePath $PSScriptRoot\custom-lists.ps1 -Append -Encoding utf8
  482. }
  483. }
  484. ')' | Out-File -FilePath $PSScriptRoot\custom-lists.ps1 -Append -Encoding utf8
  485. #Over-ride the white/blacklist with the newly saved custom list
  486. dotInclude custom-lists.ps1
  487. #convert to regular expression to allow for the super-useful -match operator
  488. $global:BloatwareRegex = $global:Bloatware -join '|'
  489. $global:WhiteListedAppsRegex = $global:WhiteListedApps -join '|'
  490. })
  491. Function AddAppToCustomizeForm() {
  492. Param(
  493. [Parameter(Mandatory)]
  494. [int] $position,
  495. [Parameter(Mandatory)]
  496. [string] $appName,
  497. [Parameter(Mandatory)]
  498. [bool] $enabled,
  499. [Parameter(Mandatory)]
  500. [bool] $checked,
  501. [Parameter(Mandatory)]
  502. [bool] $autocheck,
  503. [string] $notes
  504. )
  505. $label = New-Object System.Windows.Forms.Label
  506. $label.Location = New-Object System.Drawing.Point(0, (2 + $position * 25))
  507. $label.Text = $notes
  508. $label.Font = New-Object System.Drawing.Font('Consolas',8)
  509. $label.Width = 150
  510. $label.Height = 16
  511. $Label.TextAlign = [System.Drawing.ContentAlignment]::TopRight
  512. $label.ForeColor = [System.Drawing.ColorTranslator]::FromHtml("#888888")
  513. $ListPanel.controls.AddRange(@($label))
  514. $Checkbox = New-Object System.Windows.Forms.CheckBox
  515. $Checkbox.Text = $appName
  516. $CheckBox.Font = New-Object System.Drawing.Font('Consolas',8)
  517. $CheckBox.FlatStyle = 'Flat'
  518. $CheckBox.ForeColor = [System.Drawing.ColorTranslator]::FromHtml("#eeeeee")
  519. $Checkbox.Location = New-Object System.Drawing.Point(160, (0 + $position * 25))
  520. $Checkbox.Autosize = 1;
  521. $Checkbox.Checked = $checked
  522. $Checkbox.Enabled = $enabled
  523. $CheckBox.AutoCheck = $autocheck
  524. $ListPanel.controls.AddRange(@($CheckBox))
  525. }
  526. $Installed = @( (Get-AppxPackage).Name )
  527. $Online = @( (Get-AppxProvisionedPackage -Online).DisplayName )
  528. $AllUsers = @( (Get-AppxPackage -AllUsers).Name )
  529. [int]$checkboxCounter = 0
  530. ForEach ($item in $NonRemovables) {
  531. $string = ""
  532. if ( $null -notmatch $global:BloatwareRegex -and $item -cmatch $global:BloatwareRegex ) { $string += " ConflictBlacklist " }
  533. if ( $null -notmatch $global:WhiteListedAppsRegex -and $item -cmatch $global:WhiteListedAppsRegex ) { $string += " ConflictWhitelist" }
  534. if ( $null -notmatch $Installed -and $Installed -cmatch $item) { $string += "Installed" }
  535. if ( $null -notmatch $AllUsers -and $AllUsers -cmatch $item) { $string += " AllUsers" }
  536. if ( $null -notmatch $Online -and $Online -cmatch $item) { $string += " Online" }
  537. $string += " NON-REMOVABLE"
  538. AddAppToCustomizeForm $checkboxCounter $item $true $false $false $string
  539. ++$checkboxCounter
  540. }
  541. ForEach ( $item in $global:WhiteListedApps ) {
  542. $string = ""
  543. if ( $null -notmatch $NonRemovables -and $NonRemovables -cmatch $item ) { $string += " Conflict NonRemovables " }
  544. if ( $null -notmatch $global:BloatwareRegex -and $item -cmatch $global:BloatwareRegex ) { $string += " ConflictBlacklist " }
  545. if ( $null -notmatch $Installed -and $Installed -cmatch $item) { $string += "Installed" }
  546. if ( $null -notmatch $AllUsers -and $AllUsers -cmatch $item) { $string += " AllUsers" }
  547. if ( $null -notmatch $Online -and $Online -cmatch $item) { $string += " Online" }
  548. AddAppToCustomizeForm $checkboxCounter $item $true $false $true $string
  549. ++$checkboxCounter
  550. }
  551. ForEach ( $item in $global:Bloatware ) {
  552. $string = ""
  553. if ( $null -notmatch $NonRemovables -and $NonRemovables -cmatch $item ) { $string += " Conflict NonRemovables " }
  554. if ( $null -notmatch $global:WhiteListedAppsRegex -and $item -cmatch $global:WhiteListedAppsRegex ) { $string += " Conflict Whitelist " }
  555. if ( $null -notmatch $Installed -and $Installed -cmatch $item) { $string += "Installed" }
  556. if ( $null -notmatch $AllUsers -and $AllUsers -cmatch $item) { $string += " AllUsers" }
  557. if ( $null -notmatch $Online -and $Online -cmatch $item) { $string += " Online" }
  558. AddAppToCustomizeForm $checkboxCounter $item $true $true $true $string
  559. ++$checkboxCounter
  560. }
  561. ForEach ( $item in $AllUsers ) {
  562. $string = "NEW AllUsers"
  563. if ( $null -notmatch $NonRemovables -and $NonRemovables -cmatch $item ) { continue }
  564. if ( $null -notmatch $global:WhiteListedAppsRegex -and $item -cmatch $global:WhiteListedAppsRegex ) { continue }
  565. if ( $null -notmatch $global:BloatwareRegex -and $item -cmatch $global:BloatwareRegex ) { continue }
  566. if ( $null -notmatch $Installed -and $Installed -cmatch $item) { $string += " Installed" }
  567. if ( $null -notmatch $Online -and $Online -cmatch $item) { $string += " Online" }
  568. AddAppToCustomizeForm $checkboxCounter $item $true $true $true $string
  569. ++$checkboxCounter
  570. }
  571. ForEach ( $item in $Installed ) {
  572. $string = "NEW Installed"
  573. if ( $null -notmatch $NonRemovables -and $NonRemovables -cmatch $item ) { continue }
  574. if ( $null -notmatch $global:WhiteListedAppsRegex -and $item -cmatch $global:WhiteListedAppsRegex ) { continue }
  575. if ( $null -notmatch $global:BloatwareRegex -and $item -cmatch $global:BloatwareRegex ) { continue }
  576. if ( $null -notmatch $AllUsers -and $AllUsers -cmatch $item) { continue }
  577. if ( $null -notmatch $Online -and $Online -cmatch $item) { $string += " Online" }
  578. AddAppToCustomizeForm $checkboxCounter $item $true $true $true $string
  579. ++$checkboxCounter
  580. }
  581. ForEach ( $item in $Online ) {
  582. $string = "NEW Online "
  583. if ( $null -notmatch $NonRemovables -and $NonRemovables -cmatch $item ) { continue }
  584. if ( $null -notmatch $global:WhiteListedAppsRegex -and $item -cmatch $global:WhiteListedAppsRegex ) { continue }
  585. if ( $null -notmatch $global:BloatwareRegex -and $item -cmatch $global:BloatwareRegex ) { continue }
  586. if ( $null -notmatch $Installed -and $Installed -cmatch $item) { continue }
  587. if ( $null -notmatch $AllUsers -and $AllUsers -cmatch $item) { continue }
  588. AddAppToCustomizeForm $checkboxCounter $item $true $true $true $string
  589. ++$checkboxCounter
  590. }
  591. [void]$CustomizeForm.ShowDialog()
  592. })
  593. $RemoveBlacklistedBloatware.Add_Click( {
  594. $ErrorActionPreference = 'SilentlyContinue'
  595. Function DebloatBlacklist {
  596. Write-Host "Requesting removal of $global:BloatwareRegex"
  597. Write-Host "--- This may take a while - please be patient ---"
  598. Get-AppxPackage | Where-Object Name -cmatch $global:BloatwareRegex | Remove-AppxPackage
  599. Write-Host "...now starting the silent ProvisionedPackage bloatware removal..."
  600. Get-AppxProvisionedPackage -Online | Where-Object DisplayName -cmatch $global:BloatwareRegex | Remove-AppxProvisionedPackage -Online
  601. Write-Host "...and the final cleanup..."
  602. Get-AppxPackage -AllUsers | Where-Object Name -cmatch $global:BloatwareRegex | Remove-AppxPackage
  603. }
  604. Write-Host "`n`n`n`n`n`n`n`n`n`n`n`n`n`n`n`n`nRemoving blacklisted Bloatware.`n"
  605. DebloatBlacklist
  606. Write-Host "Bloatware removed!"
  607. })
  608. $RemoveAllBloatware.Add_Click( {
  609. $ErrorActionPreference = 'SilentlyContinue'
  610. #This function finds any AppX/AppXProvisioned package and uninstalls it, except for Freshpaint, Windows Calculator, Windows Store, and Windows Photos.
  611. #Also, to note - This does NOT remove essential system services/software/etc such as .NET framework installations, Cortana, Edge, etc.
  612. #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.
  613. Function Begin-SysPrep {
  614. Write-Host "Starting Sysprep Fixes"
  615. # Disable Windows Store Automatic Updates
  616. Write-Host "Adding Registry key to Disable Windows Store Automatic Updates"
  617. $registryPath = "HKLM:\SOFTWARE\Policies\Microsoft\WindowsStore"
  618. If (!(Test-Path $registryPath)) {
  619. Mkdir $registryPath
  620. New-ItemProperty $registryPath AutoDownload -Value 2
  621. }
  622. Set-ItemProperty $registryPath AutoDownload -Value 2
  623. #Stop WindowsStore Installer Service and set to Disabled
  624. Write-Host "Stopping InstallService"
  625. Stop-Service InstallService
  626. Write-Host "Setting InstallService Startup to Disabled"
  627. Set-Service InstallService -StartupType Disabled
  628. }
  629. Function CheckDMWService {
  630. Param([switch]$Debloat)
  631. If (Get-Service dmwappushservice | Where-Object { $_.StartType -eq "Disabled" }) {
  632. Set-Service dmwappushservice -StartupType Automatic
  633. }
  634. If (Get-Service dmwappushservice | Where-Object { $_.Status -eq "Stopped" }) {
  635. Start-Service dmwappushservice
  636. }
  637. }
  638. Function DebloatAll {
  639. #Removes AppxPackages
  640. Get-AppxPackage | Where { !($_.Name -cmatch $global:WhiteListedAppsRegex) -and !($NonRemovables -cmatch $_.Name) } | Remove-AppxPackage
  641. Get-AppxProvisionedPackage -Online | Where { !($_.DisplayName -cmatch $global:WhiteListedAppsRegex) -and !($NonRemovables -cmatch $_.DisplayName) } | Remove-AppxProvisionedPackage -Online
  642. Get-AppxPackage -AllUsers | Where { !($_.Name -cmatch $global:WhiteListedAppsRegex) -and !($NonRemovables -cmatch $_.Name) } | Remove-AppxPackage
  643. }
  644. #Creates a PSDrive to be able to access the 'HKCR' tree
  645. New-PSDrive -Name HKCR -PSProvider Registry -Root HKEY_CLASSES_ROOT
  646. Function Remove-Keys {
  647. #These are the registry keys that it will delete.
  648. $Keys = @(
  649. #Remove Background Tasks
  650. "HKCR:\Extensions\ContractId\Windows.BackgroundTasks\PackageId\46928bounde.EclipseManager_2.2.4.51_neutral__a5h4egax66k6y"
  651. "HKCR:\Extensions\ContractId\Windows.BackgroundTasks\PackageId\ActiproSoftwareLLC.562882FEEB491_2.6.18.18_neutral__24pqs290vpjk0"
  652. "HKCR:\Extensions\ContractId\Windows.BackgroundTasks\PackageId\Microsoft.MicrosoftOfficeHub_17.7909.7600.0_x64__8wekyb3d8bbwe"
  653. "HKCR:\Extensions\ContractId\Windows.BackgroundTasks\PackageId\Microsoft.PPIProjection_10.0.15063.0_neutral_neutral_cw5n1h2txyewy"
  654. "HKCR:\Extensions\ContractId\Windows.BackgroundTasks\PackageId\Microsoft.XboxGameCallableUI_1000.15063.0.0_neutral_neutral_cw5n1h2txyewy"
  655. "HKCR:\Extensions\ContractId\Windows.BackgroundTasks\PackageId\Microsoft.XboxGameCallableUI_1000.16299.15.0_neutral_neutral_cw5n1h2txyewy"
  656. #Windows File
  657. "HKCR:\Extensions\ContractId\Windows.File\PackageId\ActiproSoftwareLLC.562882FEEB491_2.6.18.18_neutral__24pqs290vpjk0"
  658. #Registry keys to delete if they aren't uninstalled by RemoveAppXPackage/RemoveAppXProvisionedPackage
  659. "HKCR:\Extensions\ContractId\Windows.Launch\PackageId\46928bounde.EclipseManager_2.2.4.51_neutral__a5h4egax66k6y"
  660. "HKCR:\Extensions\ContractId\Windows.Launch\PackageId\ActiproSoftwareLLC.562882FEEB491_2.6.18.18_neutral__24pqs290vpjk0"
  661. "HKCR:\Extensions\ContractId\Windows.Launch\PackageId\Microsoft.PPIProjection_10.0.15063.0_neutral_neutral_cw5n1h2txyewy"
  662. "HKCR:\Extensions\ContractId\Windows.Launch\PackageId\Microsoft.XboxGameCallableUI_1000.15063.0.0_neutral_neutral_cw5n1h2txyewy"
  663. "HKCR:\Extensions\ContractId\Windows.Launch\PackageId\Microsoft.XboxGameCallableUI_1000.16299.15.0_neutral_neutral_cw5n1h2txyewy"
  664. #Scheduled Tasks to delete
  665. "HKCR:\Extensions\ContractId\Windows.PreInstalledConfigTask\PackageId\Microsoft.MicrosoftOfficeHub_17.7909.7600.0_x64__8wekyb3d8bbwe"
  666. #Windows Protocol Keys
  667. "HKCR:\Extensions\ContractId\Windows.Protocol\PackageId\ActiproSoftwareLLC.562882FEEB491_2.6.18.18_neutral__24pqs290vpjk0"
  668. "HKCR:\Extensions\ContractId\Windows.Protocol\PackageId\Microsoft.PPIProjection_10.0.15063.0_neutral_neutral_cw5n1h2txyewy"
  669. "HKCR:\Extensions\ContractId\Windows.Protocol\PackageId\Microsoft.XboxGameCallableUI_1000.15063.0.0_neutral_neutral_cw5n1h2txyewy"
  670. "HKCR:\Extensions\ContractId\Windows.Protocol\PackageId\Microsoft.XboxGameCallableUI_1000.16299.15.0_neutral_neutral_cw5n1h2txyewy"
  671. #Windows Share Target
  672. "HKCR:\Extensions\ContractId\Windows.ShareTarget\PackageId\ActiproSoftwareLLC.562882FEEB491_2.6.18.18_neutral__24pqs290vpjk0"
  673. )
  674. #This writes the output of each key it is removing and also removes the keys listed above.
  675. ForEach ($Key in $Keys) {
  676. Write-Host "Removing $Key from registry"
  677. Remove-Item $Key -Recurse
  678. }
  679. }
  680. Function Protect-Privacy {
  681. #Creates a PSDrive to be able to access the 'HKCR' tree
  682. New-PSDrive -Name HKCR -PSProvider Registry -Root HKEY_CLASSES_ROOT
  683. #Disables Windows Feedback Experience
  684. Write-Host "Disabling Windows Feedback Experience program"
  685. $Advertising = 'HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\AdvertisingInfo'
  686. If (Test-Path $Advertising) {
  687. Set-ItemProperty $Advertising Enabled -Value 0
  688. }
  689. #Stops Cortana from being used as part of your Windows Search Function
  690. Write-Host "Stopping Cortana from being used as part of your Windows Search Function"
  691. $Search = 'HKLM:\SOFTWARE\Policies\Microsoft\Windows\Windows Search'
  692. If (Test-Path $Search) {
  693. Set-ItemProperty $Search AllowCortana -Value 0
  694. }
  695. #Stops the Windows Feedback Experience from sending anonymous data
  696. Write-Host "Stopping the Windows Feedback Experience program"
  697. $Period1 = 'HKCU:\Software\Microsoft\Siuf'
  698. $Period2 = 'HKCU:\Software\Microsoft\Siuf\Rules'
  699. $Period3 = 'HKCU:\Software\Microsoft\Siuf\Rules\PeriodInNanoSeconds'
  700. If (!(Test-Path $Period3)) {
  701. mkdir $Period1
  702. mkdir $Period2
  703. mkdir $Period3
  704. New-ItemProperty $Period3 PeriodInNanoSeconds -Value 0
  705. }
  706. Write-Host "Adding Registry key to prevent bloatware apps from returning"
  707. #Prevents bloatware applications from returning
  708. $registryPath = "HKLM:\SOFTWARE\Policies\Microsoft\Windows\CloudContent"
  709. If (!(Test-Path $registryPath)) {
  710. Mkdir $registryPath
  711. New-ItemProperty $registryPath DisableWindowsConsumerFeatures -Value 1
  712. }
  713. Write-Host "Setting Mixed Reality Portal value to 0 so that you can uninstall it in Settings"
  714. $Holo = 'HKCU:\Software\Microsoft\Windows\CurrentVersion\Holographic'
  715. If (Test-Path $Holo) {
  716. Set-ItemProperty $Holo FirstRunSucceeded -Value 0
  717. }
  718. #Disables live tiles
  719. Write-Host "Disabling live tiles"
  720. $Live = 'HKCU:\SOFTWARE\Policies\Microsoft\Windows\CurrentVersion\PushNotifications'
  721. If (!(Test-Path $Live)) {
  722. mkdir $Live
  723. New-ItemProperty $Live NoTileApplicationNotification -Value 1
  724. }
  725. #Turns off Data Collection via the AllowTelemtry key by changing it to 0
  726. Write-Host "Turning off Data Collection"
  727. $DataCollection = 'HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\Policies\DataCollection'
  728. If (Test-Path $DataCollection) {
  729. Set-ItemProperty $DataCollection AllowTelemetry -Value 0
  730. }
  731. #Disables People icon on Taskbar
  732. Write-Host "Disabling People icon on Taskbar"
  733. $People = 'HKCU:\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\Advanced\People'
  734. If (Test-Path $People) {
  735. Set-ItemProperty $People PeopleBand -Value 0
  736. }
  737. #Disables suggestions on start menu
  738. Write-Host "Disabling suggestions on the Start Menu"
  739. $Suggestions = 'HKCU:\Software\Microsoft\Windows\CurrentVersion\ContentDeliveryManager'
  740. If (Test-Path $Suggestions) {
  741. Set-ItemProperty $Suggestions SystemPaneSuggestionsEnabled -Value 0
  742. }
  743. Write-Host "Removing CloudStore from registry if it exists"
  744. $CloudStore = 'HKCU:\Software\Microsoft\Windows\CurrentVersion\CloudStore'
  745. If (Test-Path $CloudStore) {
  746. Stop-Process Explorer.exe -Force
  747. Remove-Item $CloudStore -Recurse -Force
  748. Start-Process Explorer.exe -Wait
  749. }
  750. #Loads the registry keys/values below into the NTUSER.DAT file which prevents the apps from redownloading. Credit to a60wattfish
  751. reg load HKU\Default_User C:\Users\Default\NTUSER.DAT
  752. Set-ItemProperty -Path Registry::HKU\Default_User\SOFTWARE\Microsoft\Windows\CurrentVersion\ContentDeliveryManager -Name SystemPaneSuggestionsEnabled -Value 0
  753. Set-ItemProperty -Path Registry::HKU\Default_User\SOFTWARE\Microsoft\Windows\CurrentVersion\ContentDeliveryManager -Name PreInstalledAppsEnabled -Value 0
  754. Set-ItemProperty -Path Registry::HKU\Default_User\SOFTWARE\Microsoft\Windows\CurrentVersion\ContentDeliveryManager -Name OemPreInstalledAppsEnabled -Value 0
  755. reg unload HKU\Default_User
  756. #Disables scheduled tasks that are considered unnecessary
  757. Write-Host "Disabling scheduled tasks"
  758. #Get-ScheduledTask -TaskName XblGameSaveTaskLogon | Disable-ScheduledTask
  759. Get-ScheduledTask -TaskName XblGameSaveTask | Disable-ScheduledTask
  760. Get-ScheduledTask -TaskName Consolidator | Disable-ScheduledTask
  761. Get-ScheduledTask -TaskName UsbCeip | Disable-ScheduledTask
  762. Get-ScheduledTask -TaskName DmClient | Disable-ScheduledTask
  763. Get-ScheduledTask -TaskName DmClientOnScenarioDownload | Disable-ScheduledTask
  764. }
  765. Function UnpinStart {
  766. #Credit to Vikingat-Rage
  767. #https://superuser.com/questions/1068382/how-to-remove-all-the-tiles-in-the-windows-10-start-menu
  768. #Unpins all tiles from the Start Menu
  769. Write-Host "Unpinning all tiles from the start menu"
  770. (New-Object -Com Shell.Application).
  771. NameSpace('shell:::{4234d49b-0245-4df3-b780-3893943456e1}').
  772. Items() |
  773. % { $_.Verbs() } |
  774. ? { $_.Name -match 'Un.*pin from Start' } |
  775. % { $_.DoIt() }
  776. }
  777. Function Remove3dObjects {
  778. #Removes 3D Objects from the 'My Computer' submenu in explorer
  779. Write-Output "Removing 3D Objects from explorer 'My Computer' submenu"
  780. $Objects32 = "HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\MyComputer\NameSpace\{0DB7E03F-FC29-4DC6-9020-FF41B59E513A}"
  781. $Objects64 = "HKLM:\SOFTWARE\WOW6432Node\Microsoft\Windows\CurrentVersion\Explorer\MyComputer\NameSpace\{0DB7E03F-FC29-4DC6-9020-FF41B59E513A}"
  782. If (Test-Path $Objects32) {
  783. Remove-Item $Objects32 -Recurse
  784. }
  785. If (Test-Path $Objects64) {
  786. Remove-Item $Objects64 -Recurse
  787. }
  788. }
  789. Function CheckDMWService {
  790. Param([switch]$Debloat)
  791. If (Get-Service dmwappushservice | Where-Object { $_.StartType -eq "Disabled" }) {
  792. Set-Service dmwappushservice -StartupType Automatic
  793. }
  794. If (Get-Service dmwappushservice | Where-Object { $_.Status -eq "Stopped" }) {
  795. Start-Service dmwappushservice
  796. }
  797. }
  798. Function CheckInstallService {
  799. If (Get-Service InstallService | Where-Object { $_.Status -eq "Stopped" }) {
  800. Start-Service InstallService
  801. Set-Service InstallService -StartupType Automatic
  802. }
  803. }
  804. Write-Host "Initiating Sysprep"
  805. Begin-SysPrep
  806. Write-Host "Removing bloatware apps."
  807. DebloatAll
  808. Write-Host "Removing leftover bloatware registry keys."
  809. Remove-Keys
  810. Write-Host "Checking to see if any Whitelisted Apps were removed, and if so re-adding them."
  811. FixWhitelistedApps
  812. Write-Host "Stopping telemetry, disabling unneccessary scheduled tasks, and preventing bloatware from returning."
  813. Protect-Privacy
  814. Write-Host "Unpinning tiles from the Start Menu."
  815. UnpinStart
  816. Write-Host "Setting the 'InstallService' Windows service back to 'Started' and the Startup Type 'Automatic'."
  817. CheckDMWService
  818. CheckInstallService
  819. Write-Host "Finished all tasks. `n"
  820. } )
  821. $RevertChanges.Add_Click( {
  822. $ErrorActionPreference = 'SilentlyContinue'
  823. #This function will revert the changes you made when running the Start-Debloat function.
  824. #This line reinstalls all of the bloatware that was removed
  825. Get-AppxPackage -AllUsers | ForEach { Add-AppxPackage -Verbose -DisableDevelopmentMode -Register "$($_.InstallLocation)\AppXManifest.xml" }
  826. #Tells Windows to enable your advertising information.
  827. Write-Host "Re-enabling key to show advertisement information"
  828. $Advertising = "HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\AdvertisingInfo"
  829. If (Test-Path $Advertising) {
  830. Set-ItemProperty $Advertising Enabled -Value 1
  831. }
  832. #Enables Cortana to be used as part of your Windows Search Function
  833. Write-Host "Re-enabling Cortana to be used in your Windows Search"
  834. $Search = "HKLM:\SOFTWARE\Policies\Microsoft\Windows\Windows Search"
  835. If (Test-Path $Search) {
  836. Set-ItemProperty $Search AllowCortana -Value 1
  837. }
  838. #Re-enables the Windows Feedback Experience for sending anonymous data
  839. Write-Host "Re-enabling Windows Feedback Experience"
  840. $Period = "HKCU:\Software\Microsoft\Siuf\Rules"
  841. If (!(Test-Path $Period)) {
  842. New-Item $Period
  843. }
  844. Set-ItemProperty $Period PeriodInNanoSeconds -Value 1
  845. #Enables bloatware applications
  846. Write-Host "Adding Registry key to allow bloatware apps to return"
  847. $registryPath = "HKLM:\SOFTWARE\Policies\Microsoft\Windows\CloudContent"
  848. If (!(Test-Path $registryPath)) {
  849. New-Item $registryPath
  850. }
  851. Set-ItemProperty $registryPath DisableWindowsConsumerFeatures -Value 0
  852. #Changes Mixed Reality Portal Key 'FirstRunSucceeded' to 1
  853. Write-Host "Setting Mixed Reality Portal value to 1"
  854. $Holo = "HKCU:\Software\Microsoft\Windows\CurrentVersion\Holographic"
  855. If (Test-Path $Holo) {
  856. Set-ItemProperty $Holo FirstRunSucceeded -Value 1
  857. }
  858. #Re-enables live tiles
  859. Write-Host "Enabling live tiles"
  860. $Live = "HKCU:\SOFTWARE\Policies\Microsoft\Windows\CurrentVersion\PushNotifications"
  861. If (!(Test-Path $Live)) {
  862. New-Item $Live
  863. }
  864. Set-ItemProperty $Live NoTileApplicationNotification -Value 0
  865. #Re-enables data collection
  866. Write-Host "Re-enabling data collection"
  867. $DataCollection = "HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\Policies\DataCollection"
  868. If (!(Test-Path $DataCollection)) {
  869. New-Item $DataCollection
  870. }
  871. Set-ItemProperty $DataCollection AllowTelemetry -Value 1
  872. #Re-enables People Icon on Taskbar
  873. Write-Host "Enabling People Icon on Taskbar"
  874. $People = 'HKCU:\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\Advanced\People'
  875. If (Test-Path $People) {
  876. Set-ItemProperty $People -Name PeopleBand -Value 1 -Verbose
  877. }
  878. #Re-enables suggestions on start menu
  879. Write-Host "Enabling suggestions on the Start Menu"
  880. $Suggestions = "HKCU:\Software\Microsoft\Windows\CurrentVersion\ContentDeliveryManager"
  881. If (!(Test-Path $Suggestions)) {
  882. New-Item $Suggestions
  883. }
  884. Set-ItemProperty $Suggestions SystemPaneSuggestionsEnabled -Value 1
  885. #Re-enables scheduled tasks that were disabled when running the Debloat switch
  886. Write-Host "Enabling scheduled tasks that were disabled"
  887. Get-ScheduledTask XblGameSaveTaskLogon | Enable-ScheduledTask
  888. Get-ScheduledTask XblGameSaveTask | Enable-ScheduledTask
  889. Get-ScheduledTask Consolidator | Enable-ScheduledTask
  890. Get-ScheduledTask UsbCeip | Enable-ScheduledTask
  891. Get-ScheduledTask DmClient | Enable-ScheduledTask
  892. Get-ScheduledTask DmClientOnScenarioDownload | Enable-ScheduledTask
  893. Write-Host "Re-enabling and starting WAP Push Service"
  894. #Enable and start WAP Push Service
  895. Set-Service "dmwappushservice" -StartupType Automatic
  896. Start-Service "dmwappushservice"
  897. Write-Host "Re-enabling and starting the Diagnostics Tracking Service"
  898. #Enabling the Diagnostics Tracking Service
  899. Set-Service "DiagTrack" -StartupType Automatic
  900. Start-Service "DiagTrack"
  901. Write-Host "Done reverting changes!"
  902. #
  903. Write-Output "Restoring 3D Objects from Explorer 'My Computer' submenu"
  904. $Objects32 = "HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\MyComputer\NameSpace\{0DB7E03F-FC29-4DC6-9020-FF41B59E513A}"
  905. $Objects64 = "HKLM:\SOFTWARE\WOW6432Node\Microsoft\Windows\CurrentVersion\Explorer\MyComputer\NameSpace\{0DB7E03F-FC29-4DC6-9020-FF41B59E513A}"
  906. If (!(Test-Path $Objects32)) {
  907. New-Item $Objects32
  908. }
  909. If (!(Test-Path $Objects64)) {
  910. New-Item $Objects64
  911. }
  912. })
  913. $DisableCortana.Add_Click( {
  914. $ErrorActionPreference = 'SilentlyContinue'
  915. Write-Host "Disabling Cortana"
  916. $Cortana1 = "HKCU:\SOFTWARE\Microsoft\Personalization\Settings"
  917. $Cortana2 = "HKCU:\SOFTWARE\Microsoft\InputPersonalization"
  918. $Cortana3 = "HKCU:\SOFTWARE\Microsoft\InputPersonalization\TrainedDataStore"
  919. If (!(Test-Path $Cortana1)) {
  920. New-Item $Cortana1
  921. }
  922. Set-ItemProperty $Cortana1 AcceptedPrivacyPolicy -Value 0
  923. If (!(Test-Path $Cortana2)) {
  924. New-Item $Cortana2
  925. }
  926. Set-ItemProperty $Cortana2 RestrictImplicitTextCollection -Value 1
  927. Set-ItemProperty $Cortana2 RestrictImplicitInkCollection -Value 1
  928. If (!(Test-Path $Cortana3)) {
  929. New-Item $Cortana3
  930. }
  931. Set-ItemProperty $Cortana3 HarvestContacts -Value 0
  932. Write-Host "Cortana has been disabled."
  933. })
  934. $DisableEdgePDFTakeover.Add_Click( {
  935. $ErrorActionPreference = 'SilentlyContinue'
  936. #Stops edge from taking over as the default .PDF viewer
  937. Write-Host "Stopping Edge from taking over as the default .PDF viewer"
  938. $NoPDF = "HKCR:\.pdf"
  939. $NoProgids = "HKCR:\.pdf\OpenWithProgids"
  940. $NoWithList = "HKCR:\.pdf\OpenWithList"
  941. If (!(Get-ItemProperty $NoPDF NoOpenWith)) {
  942. New-ItemProperty $NoPDF NoOpenWith
  943. }
  944. If (!(Get-ItemProperty $NoPDF NoStaticDefaultVerb)) {
  945. New-ItemProperty $NoPDF NoStaticDefaultVerb
  946. }
  947. If (!(Get-ItemProperty $NoProgids NoOpenWith)) {
  948. New-ItemProperty $NoProgids NoOpenWith
  949. }
  950. If (!(Get-ItemProperty $NoProgids NoStaticDefaultVerb)) {
  951. New-ItemProperty $NoProgids NoStaticDefaultVerb
  952. }
  953. If (!(Get-ItemProperty $NoWithList NoOpenWith)) {
  954. New-ItemProperty $NoWithList NoOpenWith
  955. }
  956. If (!(Get-ItemProperty $NoWithList NoStaticDefaultVerb)) {
  957. New-ItemProperty $NoWithList NoStaticDefaultVerb
  958. }
  959. #Appends an underscore '_' to the Registry key for Edge
  960. $Edge = "HKCR:\AppXd4nrz8ff68srnhf9t5a8sbjyar1cr723_"
  961. If (Test-Path $Edge) {
  962. Set-Item $Edge AppXd4nrz8ff68srnhf9t5a8sbjyar1cr723_
  963. }
  964. Write-Host "Edge should no longer take over as the default .PDF."
  965. })
  966. $EnableCortana.Add_Click( {
  967. $ErrorActionPreference = 'SilentlyContinue'
  968. Write-Host "Re-enabling Cortana"
  969. $Cortana1 = "HKCU:\SOFTWARE\Microsoft\Personalization\Settings"
  970. $Cortana2 = "HKCU:\SOFTWARE\Microsoft\InputPersonalization"
  971. $Cortana3 = "HKCU:\SOFTWARE\Microsoft\InputPersonalization\TrainedDataStore"
  972. If (!(Test-Path $Cortana1)) {
  973. New-Item $Cortana1
  974. }
  975. Set-ItemProperty $Cortana1 AcceptedPrivacyPolicy -Value 1
  976. If (!(Test-Path $Cortana2)) {
  977. New-Item $Cortana2
  978. }
  979. Set-ItemProperty $Cortana2 RestrictImplicitTextCollection -Value 0
  980. Set-ItemProperty $Cortana2 RestrictImplicitInkCollection -Value 0
  981. If (!(Test-Path $Cortana3)) {
  982. New-Item $Cortana3
  983. }
  984. Set-ItemProperty $Cortana3 HarvestContacts -Value 1
  985. Write-Host "Cortana has been enabled!"
  986. })
  987. $EnableEdgePDFTakeover.Add_Click( {
  988. New-PSDrive HKCR -PSProvider Registry -Root HKEY_CLASSES_ROOT
  989. $ErrorActionPreference = 'SilentlyContinue'
  990. Write-Host "Setting Edge back to default"
  991. $NoPDF = "HKCR:\.pdf"
  992. $NoProgids = "HKCR:\.pdf\OpenWithProgids"
  993. $NoWithList = "HKCR:\.pdf\OpenWithList"
  994. #Sets edge back to default
  995. If (Get-ItemProperty $NoPDF NoOpenWith) {
  996. Remove-ItemProperty $NoPDF NoOpenWith
  997. }
  998. If (Get-ItemProperty $NoPDF NoStaticDefaultVerb) {
  999. Remove-ItemProperty $NoPDF NoStaticDefaultVerb
  1000. }
  1001. If (Get-ItemProperty $NoProgids NoOpenWith) {
  1002. Remove-ItemProperty $NoProgids NoOpenWith
  1003. }
  1004. If (Get-ItemProperty $NoProgids NoStaticDefaultVerb) {
  1005. Remove-ItemProperty $NoProgids NoStaticDefaultVerb
  1006. }
  1007. If (Get-ItemProperty $NoWithList NoOpenWith) {
  1008. Remove-ItemProperty $NoWithList NoOpenWith
  1009. }
  1010. If (Get-ItemProperty $NoWithList NoStaticDefaultVerb) {
  1011. Remove-ItemProperty $NoWithList NoStaticDefaultVerb
  1012. }
  1013. #Removes an underscore '_' from the Registry key for Edge
  1014. $Edge2 = "HKCR:\AppXd4nrz8ff68srnhf9t5a8sbjyar1cr723_"
  1015. If (Test-Path $Edge2) {
  1016. Set-Item $Edge2 AppXd4nrz8ff68srnhf9t5a8sbjyar1cr723
  1017. }
  1018. Write-Host "Edge will now be able to be used for .PDF."
  1019. })
  1020. $DisableTelemetry.Add_Click( {
  1021. $ErrorActionPreference = 'SilentlyContinue'
  1022. #Disables Windows Feedback Experience
  1023. Write-Host "Disabling Windows Feedback Experience program"
  1024. $Advertising = "HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\AdvertisingInfo"
  1025. If (Test-Path $Advertising) {
  1026. Set-ItemProperty $Advertising Enabled -Value 0
  1027. }
  1028. #Stops Cortana from being used as part of your Windows Search Function
  1029. Write-Host "Stopping Cortana from being used as part of your Windows Search Function"
  1030. $Search = "HKLM:\SOFTWARE\Policies\Microsoft\Windows\Windows Search"
  1031. If (Test-Path $Search) {
  1032. Set-ItemProperty $Search AllowCortana -Value 0
  1033. }
  1034. #Disables Web Search in Start Menu
  1035. Write-Host "Disabling Bing Search in Start Menu"
  1036. $WebSearch = "HKLM:\SOFTWARE\Policies\Microsoft\Windows\Windows Search"
  1037. Set-ItemProperty "HKCU:\SOFTWARE\Microsoft\Windows\CurrentVersion\Search" BingSearchEnabled -Value 0
  1038. If (!(Test-Path $WebSearch)) {
  1039. New-Item $WebSearch
  1040. }
  1041. Set-ItemProperty $WebSearch DisableWebSearch -Value 1
  1042. #Stops the Windows Feedback Experience from sending anonymous data
  1043. Write-Host "Stopping the Windows Feedback Experience program"
  1044. $Period = "HKCU:\Software\Microsoft\Siuf\Rules"
  1045. If (!(Test-Path $Period)) {
  1046. New-Item $Period
  1047. }
  1048. Set-ItemProperty $Period PeriodInNanoSeconds -Value 0
  1049. #Prevents bloatware applications from returning and removes Start Menu suggestions
  1050. Write-Host "Adding Registry key to prevent bloatware apps from returning"
  1051. $registryPath = "HKLM:\SOFTWARE\Policies\Microsoft\Windows\CloudContent"
  1052. $registryOEM = "HKCU:\SOFTWARE\Microsoft\Windows\CurrentVersion\ContentDeliveryManager"
  1053. If (!(Test-Path $registryPath)) {
  1054. New-Item $registryPath
  1055. }
  1056. Set-ItemProperty $registryPath DisableWindowsConsumerFeatures -Value 1
  1057. If (!(Test-Path $registryOEM)) {
  1058. New-Item $registryOEM
  1059. }
  1060. Set-ItemProperty $registryOEM ContentDeliveryAllowed -Value 0
  1061. Set-ItemProperty $registryOEM OemPreInstalledAppsEnabled -Value 0
  1062. Set-ItemProperty $registryOEM PreInstalledAppsEnabled -Value 0
  1063. Set-ItemProperty $registryOEM PreInstalledAppsEverEnabled -Value 0
  1064. Set-ItemProperty $registryOEM SilentInstalledAppsEnabled -Value 0
  1065. Set-ItemProperty $registryOEM SystemPaneSuggestionsEnabled -Value 0
  1066. #Preping mixed Reality Portal for removal
  1067. Write-Host "Setting Mixed Reality Portal value to 0 so that you can uninstall it in Settings"
  1068. $Holo = "HKCU:\Software\Microsoft\Windows\CurrentVersion\Holographic"
  1069. If (Test-Path $Holo) {
  1070. Set-ItemProperty $Holo FirstRunSucceeded -Value 0
  1071. }
  1072. #Disables Wi-fi Sense
  1073. Write-Host "Disabling Wi-Fi Sense"
  1074. $WifiSense1 = "HKLM:\SOFTWARE\Microsoft\PolicyManager\default\WiFi\AllowWiFiHotSpotReporting"
  1075. $WifiSense2 = "HKLM:\SOFTWARE\Microsoft\PolicyManager\default\WiFi\AllowAutoConnectToWiFiSenseHotspots"
  1076. $WifiSense3 = "HKLM:\SOFTWARE\Microsoft\WcmSvc\wifinetworkmanager\config"
  1077. If (!(Test-Path $WifiSense1)) {
  1078. New-Item $WifiSense1
  1079. }
  1080. Set-ItemProperty $WifiSense1 Value -Value 0
  1081. If (!(Test-Path $WifiSense2)) {
  1082. New-Item $WifiSense2
  1083. }
  1084. Set-ItemProperty $WifiSense2 Value -Value 0
  1085. Set-ItemProperty $WifiSense3 AutoConnectAllowedOEM -Value 0
  1086. #Disables live tiles
  1087. Write-Host "Disabling live tiles"
  1088. $Live = "HKCU:\SOFTWARE\Policies\Microsoft\Windows\CurrentVersion\PushNotifications"
  1089. If (!(Test-Path $Live)) {
  1090. New-Item $Live
  1091. }
  1092. Set-ItemProperty $Live NoTileApplicationNotification -Value 1
  1093. #Turns off Data Collection via the AllowTelemtry key by changing it to 0
  1094. Write-Host "Turning off Data Collection"
  1095. $DataCollection1 = "HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\Policies\DataCollection"
  1096. $DataCollection2 = "HKLM:\SOFTWARE\Policies\Microsoft\Windows\DataCollection"
  1097. $DataCollection3 = "HKLM:\SOFTWARE\Wow6432Node\Microsoft\Windows\CurrentVersion\Policies\DataCollection"
  1098. If (Test-Path $DataCollection1) {
  1099. Set-ItemProperty $DataCollection1 AllowTelemetry -Value 0
  1100. }
  1101. If (Test-Path $DataCollection2) {
  1102. Set-ItemProperty $DataCollection2 AllowTelemetry -Value 0
  1103. }
  1104. If (Test-Path $DataCollection3) {
  1105. Set-ItemProperty $DataCollection3 AllowTelemetry -Value 0
  1106. }
  1107. #Disabling Location Tracking
  1108. Write-Host "Disabling Location Tracking"
  1109. $SensorState = "HKLM:\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Sensor\Overrides\{BFA794E4-F964-4FDB-90F6-51056BFE4B44}"
  1110. $LocationConfig = "HKLM:\SYSTEM\CurrentControlSet\Services\lfsvc\Service\Configuration"
  1111. If (!(Test-Path $SensorState)) {
  1112. New-Item $SensorState
  1113. }
  1114. Set-ItemProperty $SensorState SensorPermissionState -Value 0
  1115. If (!(Test-Path $LocationConfig)) {
  1116. New-Item $LocationConfig
  1117. }
  1118. Set-ItemProperty $LocationConfig Status -Value 0
  1119. #Disables People icon on Taskbar
  1120. Write-Host "Disabling People icon on Taskbar"
  1121. $People = 'HKCU:\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\Advanced\People'
  1122. If (Test-Path $People) {
  1123. Set-ItemProperty $People -Name PeopleBand -Value 0
  1124. }
  1125. #Disables scheduled tasks that are considered unnecessary
  1126. Write-Host "Disabling scheduled tasks"
  1127. #Get-ScheduledTask XblGameSaveTaskLogon | Disable-ScheduledTask
  1128. Get-ScheduledTask XblGameSaveTask | Disable-ScheduledTask
  1129. Get-ScheduledTask Consolidator | Disable-ScheduledTask
  1130. Get-ScheduledTask UsbCeip | Disable-ScheduledTask
  1131. Get-ScheduledTask DmClient | Disable-ScheduledTask
  1132. Get-ScheduledTask DmClientOnScenarioDownload | Disable-ScheduledTask
  1133. #Write-Host "Uninstalling Telemetry Windows Updates"
  1134. #Uninstalls Some Windows Updates considered to be Telemetry. !WIP!
  1135. #Wusa /Uninstall /KB:3022345 /norestart /quiet
  1136. #Wusa /Uninstall /KB:3068708 /norestart /quiet
  1137. #Wusa /Uninstall /KB:3075249 /norestart /quiet
  1138. #Wusa /Uninstall /KB:3080149 /norestart /quiet
  1139. Write-Host "Stopping and disabling WAP Push Service"
  1140. #Stop and disable WAP Push Service
  1141. Stop-Service "dmwappushservice"
  1142. Set-Service "dmwappushservice" -StartupType Disabled
  1143. Write-Host "Stopping and disabling Diagnostics Tracking Service"
  1144. #Disabling the Diagnostics Tracking Service
  1145. Stop-Service "DiagTrack"
  1146. Set-Service "DiagTrack" -StartupType Disabled
  1147. Write-Host "Telemetry has been disabled!"
  1148. })
  1149. $RemoveRegkeys.Add_Click( {
  1150. $ErrorActionPreference = 'SilentlyContinue'
  1151. $Keys = @(
  1152. New-PSDrive HKCR -PSProvider Registry -Root HKEY_CLASSES_ROOT
  1153. #Remove Background Tasks
  1154. "HKCR:\Extensions\ContractId\Windows.BackgroundTasks\PackageId\46928bounde.EclipseManager_2.2.4.51_neutral__a5h4egax66k6y"
  1155. "HKCR:\Extensions\ContractId\Windows.BackgroundTasks\PackageId\ActiproSoftwareLLC.562882FEEB491_2.6.18.18_neutral__24pqs290vpjk0"
  1156. "HKCR:\Extensions\ContractId\Windows.BackgroundTasks\PackageId\Microsoft.MicrosoftOfficeHub_17.7909.7600.0_x64__8wekyb3d8bbwe"
  1157. "HKCR:\Extensions\ContractId\Windows.BackgroundTasks\PackageId\Microsoft.PPIProjection_10.0.15063.0_neutral_neutral_cw5n1h2txyewy"
  1158. "HKCR:\Extensions\ContractId\Windows.BackgroundTasks\PackageId\Microsoft.XboxGameCallableUI_1000.15063.0.0_neutral_neutral_cw5n1h2txyewy"
  1159. "HKCR:\Extensions\ContractId\Windows.BackgroundTasks\PackageId\Microsoft.XboxGameCallableUI_1000.16299.15.0_neutral_neutral_cw5n1h2txyewy"
  1160. #Windows File
  1161. "HKCR:\Extensions\ContractId\Windows.File\PackageId\ActiproSoftwareLLC.562882FEEB491_2.6.18.18_neutral__24pqs290vpjk0"
  1162. #Registry keys to delete if they aren't uninstalled by RemoveAppXPackage/RemoveAppXProvisionedPackage
  1163. "HKCR:\Extensions\ContractId\Windows.Launch\PackageId\46928bounde.EclipseManager_2.2.4.51_neutral__a5h4egax66k6y"
  1164. "HKCR:\Extensions\ContractId\Windows.Launch\PackageId\ActiproSoftwareLLC.562882FEEB491_2.6.18.18_neutral__24pqs290vpjk0"
  1165. "HKCR:\Extensions\ContractId\Windows.Launch\PackageId\Microsoft.PPIProjection_10.0.15063.0_neutral_neutral_cw5n1h2txyewy"
  1166. "HKCR:\Extensions\ContractId\Windows.Launch\PackageId\Microsoft.XboxGameCallableUI_1000.15063.0.0_neutral_neutral_cw5n1h2txyewy"
  1167. "HKCR:\Extensions\ContractId\Windows.Launch\PackageId\Microsoft.XboxGameCallableUI_1000.16299.15.0_neutral_neutral_cw5n1h2txyewy"
  1168. #Scheduled Tasks to delete
  1169. "HKCR:\Extensions\ContractId\Windows.PreInstalledConfigTask\PackageId\Microsoft.MicrosoftOfficeHub_17.7909.7600.0_x64__8wekyb3d8bbwe"
  1170. #Windows Protocol Keys
  1171. "HKCR:\Extensions\ContractId\Windows.Protocol\PackageId\ActiproSoftwareLLC.562882FEEB491_2.6.18.18_neutral__24pqs290vpjk0"
  1172. "HKCR:\Extensions\ContractId\Windows.Protocol\PackageId\Microsoft.PPIProjection_10.0.15063.0_neutral_neutral_cw5n1h2txyewy"
  1173. "HKCR:\Extensions\ContractId\Windows.Protocol\PackageId\Microsoft.XboxGameCallableUI_1000.15063.0.0_neutral_neutral_cw5n1h2txyewy"
  1174. "HKCR:\Extensions\ContractId\Windows.Protocol\PackageId\Microsoft.XboxGameCallableUI_1000.16299.15.0_neutral_neutral_cw5n1h2txyewy"
  1175. #Windows Share Target
  1176. "HKCR:\Extensions\ContractId\Windows.ShareTarget\PackageId\ActiproSoftwareLLC.562882FEEB491_2.6.18.18_neutral__24pqs290vpjk0"
  1177. )
  1178. #This writes the output of each key it is removing and also removes the keys listed above.
  1179. ForEach ($Key in $Keys) {
  1180. Write-Host "Removing $Key from registry"
  1181. Remove-Item $Key -Recurse
  1182. }
  1183. Write-Host "Additional bloatware keys have been removed!"
  1184. })
  1185. $UnpinStartMenuTiles.Add_Click( {
  1186. #https://superuser.com/questions/1068382/how-to-remove-all-the-tiles-in-the-windows-10-start-menu
  1187. #Unpins all tiles from the Start Menu
  1188. Write-Host "Unpinning all tiles from the start menu"
  1189. (New-Object -Com Shell.Application).
  1190. NameSpace('shell:::{4234d49b-0245-4df3-b780-3893943456e1}').
  1191. Items() |
  1192. % { $_.Verbs() } |
  1193. ? { $_.Name -match 'Un.*pin from Start' } |
  1194. % { $_.DoIt() }
  1195. })
  1196. $RemoveOnedrive.Add_Click( {
  1197. If (Test-Path "$env:USERPROFILE\OneDrive\*") {
  1198. Write-Host "Files found within the OneDrive folder! Checking to see if a folder named OneDriveBackupFiles exists."
  1199. Start-Sleep 1
  1200. If (Test-Path "$env:USERPROFILE\Desktop\OneDriveBackupFiles") {
  1201. Write-Host "A folder named OneDriveBackupFiles already exists on your desktop. All files from your OneDrive location will be moved to that folder."
  1202. }
  1203. else {
  1204. If (!(Test-Path "$env:USERPROFILE\Desktop\OneDriveBackupFiles")) {
  1205. Write-Host "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."
  1206. New-item -Path "$env:USERPROFILE\Desktop" -Name "OneDriveBackupFiles"-ItemType Directory -Force
  1207. Write-Host "Successfully created the folder 'OneDriveBackupFiles' on your desktop."
  1208. }
  1209. }
  1210. Start-Sleep 1
  1211. Move-Item -Path "$env:USERPROFILE\OneDrive\*" -Destination "$env:USERPROFILE\Desktop\OneDriveBackupFiles" -Force
  1212. Write-Host "Successfully moved all files/folders from your OneDrive folder to the folder 'OneDriveBackupFiles' on your desktop."
  1213. Start-Sleep 1
  1214. Write-Host "Proceeding with the removal of OneDrive."
  1215. Start-Sleep 1
  1216. }
  1217. Else {
  1218. Write-Host "Either the OneDrive folder does not exist or there are no files to be found in the folder. Proceeding with removal of OneDrive."
  1219. Start-Sleep 1
  1220. Write-Host "Enabling the Group Policy 'Prevent the usage of OneDrive for File Storage'."
  1221. $OneDriveKey = 'HKLM:Software\Policies\Microsoft\Windows\OneDrive'
  1222. If (!(Test-Path $OneDriveKey)) {
  1223. Mkdir $OneDriveKey
  1224. Set-ItemProperty $OneDriveKey -Name OneDrive -Value DisableFileSyncNGSC
  1225. }
  1226. Set-ItemProperty $OneDriveKey -Name OneDrive -Value DisableFileSyncNGSC
  1227. }
  1228. Write-Host "Uninstalling OneDrive. Please wait..."
  1229. New-PSDrive HKCR -PSProvider Registry -Root HKEY_CLASSES_ROOT
  1230. $onedrive = "$env:SYSTEMROOT\SysWOW64\OneDriveSetup.exe"
  1231. $ExplorerReg1 = "HKCR:\CLSID\{018D5C66-4533-4307-9B53-224DE2ED1FE6}"
  1232. $ExplorerReg2 = "HKCR:\Wow6432Node\CLSID\{018D5C66-4533-4307-9B53-224DE2ED1FE6}"
  1233. Stop-Process -Name "OneDrive*"
  1234. Start-Sleep 2
  1235. If (!(Test-Path $onedrive)) {
  1236. $onedrive = "$env:SYSTEMROOT\System32\OneDriveSetup.exe"
  1237. }
  1238. Start-Process $onedrive "/uninstall" -NoNewWindow -Wait
  1239. Start-Sleep 2
  1240. Write-Host "Stopping explorer"
  1241. Start-Sleep 1
  1242. taskkill.exe /F /IM explorer.exe
  1243. Start-Sleep 3
  1244. Write-Host "Removing leftover files"
  1245. If (Test-Path "$env:USERPROFILE\OneDrive") {
  1246. Remove-Item "$env:USERPROFILE\OneDrive" -Force -Recurse
  1247. }
  1248. If (Test-Path "$env:LOCALAPPDATA\Microsoft\OneDrive") {
  1249. Remove-Item "$env:LOCALAPPDATA\Microsoft\OneDrive" -Force -Recurse
  1250. }
  1251. If (Test-Path "$env:PROGRAMDATA\Microsoft OneDrive") {
  1252. Remove-Item "$env:PROGRAMDATA\Microsoft OneDrive" -Force -Recurse
  1253. }
  1254. If (Test-Path "$env:SYSTEMDRIVE\OneDriveTemp") {
  1255. Remove-Item "$env:SYSTEMDRIVE\OneDriveTemp" -Force -Recurse
  1256. }
  1257. Write-Host "Removing OneDrive from windows explorer"
  1258. If (!(Test-Path $ExplorerReg1)) {
  1259. New-Item $ExplorerReg1
  1260. }
  1261. Set-ItemProperty $ExplorerReg1 System.IsPinnedToNameSpaceTree -Value 0
  1262. If (!(Test-Path $ExplorerReg2)) {
  1263. New-Item $ExplorerReg2
  1264. }
  1265. Set-ItemProperty $ExplorerReg2 System.IsPinnedToNameSpaceTree -Value 0
  1266. Write-Host "Restarting Explorer that was shut down before."
  1267. Start-Process explorer.exe -NoNewWindow
  1268. Write-Host "OneDrive has been successfully uninstalled!"
  1269. Remove-item env:OneDrive
  1270. })
  1271. $InstallNet35.Add_Click( {
  1272. Write-Host "Initializing the installation of .NET 3.5..."
  1273. DISM /Online /Enable-Feature /FeatureName:NetFx3 /All
  1274. Write-Host ".NET 3.5 has been successfully installed!"
  1275. } )
  1276. $EnableDarkMode.Add_Click( {
  1277. Write-Host "Enabling Dark Mode"
  1278. $Theme = "HKCU:\SOFTWARE\Microsoft\Windows\CurrentVersion\Themes\Personalize"
  1279. Set-ItemProperty $Theme AppsUseLightTheme -Value 0
  1280. Start-Sleep 1
  1281. Write-Host "Enabled"
  1282. }
  1283. )
  1284. $DisableDarkMode.Add_Click( {
  1285. Write-Host "Disabling Dark Mode"
  1286. $Theme = "HKCU:\SOFTWARE\Microsoft\Windows\CurrentVersion\Themes\Personalize"
  1287. Set-ItemProperty $Theme AppsUseLightTheme -Value 1
  1288. Start-Sleep 1
  1289. Write-Host "Disabled"
  1290. }
  1291. )
  1292. [void]$Form.ShowDialog()