Windows10DebloaterGUI.ps1 75 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481
  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 = "Windows10Debloater"
  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 BLOCKLIST"
  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 BLOCKLIST"
  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. Write-Output "Creating System Restore Point if one does not already exist. If one does, then you will receive a warning. Please wait..."
  441. Checkpoint-Computer -Description "Before using W10DebloaterGUI.ps1"
  442. #region gui events {
  443. $CustomizeBlacklist.Add_Click( {
  444. $CustomizeForm = New-Object System.Windows.Forms.Form
  445. $CustomizeForm.ClientSize = New-Object System.Drawing.Point(500,570)
  446. $CustomizeForm.StartPosition = 'CenterScreen'
  447. $CustomizeForm.FormBorderStyle = 'FixedSingle'
  448. $CustomizeForm.MinimizeBox = $false
  449. $CustomizeForm.MaximizeBox = $false
  450. $CustomizeForm.ShowIcon = $false
  451. $CustomizeForm.Text = "Customize Allowlist and Blocklist"
  452. $CustomizeForm.TopMost = $false
  453. $CustomizeForm.AutoScroll = $false
  454. $CustomizeForm.BackColor = [System.Drawing.ColorTranslator]::FromHtml("#252525")
  455. $ListPanel = New-Object system.Windows.Forms.Panel
  456. $ListPanel.height = 510
  457. $ListPanel.width = 480
  458. $ListPanel.Anchor = 'top,right,left'
  459. $ListPanel.location = New-Object System.Drawing.Point(10,10)
  460. $ListPanel.AutoScroll = $true
  461. $ListPanel.BackColor = [System.Drawing.ColorTranslator]::FromHtml("#252525")
  462. $SaveList = New-Object System.Windows.Forms.Button
  463. $SaveList.FlatStyle = 'Flat'
  464. $SaveList.Text = "Save custom Allowlist and Blocklist to custom-lists.ps1"
  465. $SaveList.width = 480
  466. $SaveList.height = 30
  467. $SaveList.Location = New-Object System.Drawing.Point(10, 530)
  468. $SaveList.Font = New-Object System.Drawing.Font('Consolas',9)
  469. $SaveList.ForeColor = [System.Drawing.ColorTranslator]::FromHtml("#eeeeee")
  470. $CustomizeForm.controls.AddRange(@($SaveList,$ListPanel))
  471. $SaveList.Add_Click( {
  472. $ErrorActionPreference = 'SilentlyContinue'
  473. '$global:WhiteListedApps = @(' | Out-File -FilePath $PSScriptRoot\custom-lists.ps1 -Encoding utf8
  474. @($CustomizeForm.controls) | ForEach {
  475. if ($_ -is [System.Windows.Forms.CheckBox] -and $_.Enabled -and !$_.Checked) {
  476. " ""$( $_.Text )""" | Out-File -FilePath $PSScriptRoot\custom-lists.ps1 -Append -Encoding utf8
  477. }
  478. }
  479. ')' | Out-File -FilePath $PSScriptRoot\custom-lists.ps1 -Append -Encoding utf8
  480. '$global:Bloatware = @(' | Out-File -FilePath $PSScriptRoot\custom-lists.ps1 -Append -Encoding utf8
  481. @($CustomizeForm.controls) | ForEach {
  482. if ($_ -is [System.Windows.Forms.CheckBox] -and $_.Enabled -and $_.Checked) {
  483. " ""$($_.Text)""" | Out-File -FilePath $PSScriptRoot\custom-lists.ps1 -Append -Encoding utf8
  484. }
  485. }
  486. ')' | Out-File -FilePath $PSScriptRoot\custom-lists.ps1 -Append -Encoding utf8
  487. #Over-ride the white/blacklist with the newly saved custom list
  488. dotInclude custom-lists.ps1
  489. #convert to regular expression to allow for the super-useful -match operator
  490. $global:BloatwareRegex = $global:Bloatware -join '|'
  491. $global:WhiteListedAppsRegex = $global:WhiteListedApps -join '|'
  492. })
  493. Function AddAppToCustomizeForm() {
  494. Param(
  495. [Parameter(Mandatory)]
  496. [int] $position,
  497. [Parameter(Mandatory)]
  498. [string] $appName,
  499. [Parameter(Mandatory)]
  500. [bool] $enabled,
  501. [Parameter(Mandatory)]
  502. [bool] $checked,
  503. [Parameter(Mandatory)]
  504. [bool] $autocheck,
  505. [string] $notes
  506. )
  507. $label = New-Object System.Windows.Forms.Label
  508. $label.Location = New-Object System.Drawing.Point(0, (2 + $position * 25))
  509. $label.Text = $notes
  510. $label.Font = New-Object System.Drawing.Font('Consolas',8)
  511. $label.Width = 150
  512. $label.Height = 16
  513. $Label.TextAlign = [System.Drawing.ContentAlignment]::TopRight
  514. $label.ForeColor = [System.Drawing.ColorTranslator]::FromHtml("#888888")
  515. $ListPanel.controls.AddRange(@($label))
  516. $Checkbox = New-Object System.Windows.Forms.CheckBox
  517. $Checkbox.Text = $appName
  518. $CheckBox.Font = New-Object System.Drawing.Font('Consolas',8)
  519. $CheckBox.FlatStyle = 'Flat'
  520. $CheckBox.ForeColor = [System.Drawing.ColorTranslator]::FromHtml("#eeeeee")
  521. $Checkbox.Location = New-Object System.Drawing.Point(160, (0 + $position * 25))
  522. $Checkbox.Autosize = 1;
  523. $Checkbox.Checked = $checked
  524. $Checkbox.Enabled = $enabled
  525. $CheckBox.AutoCheck = $autocheck
  526. $ListPanel.controls.AddRange(@($CheckBox))
  527. }
  528. $Installed = @( (Get-AppxPackage).Name )
  529. $Online = @( (Get-AppxProvisionedPackage -Online).DisplayName )
  530. $AllUsers = @( (Get-AppxPackage -AllUsers).Name )
  531. [int]$checkboxCounter = 0
  532. ForEach ($item in $NonRemovables) {
  533. $string = ""
  534. if ( $null -notmatch $global:BloatwareRegex -and $item -cmatch $global:BloatwareRegex ) { $string += " ConflictBlacklist " }
  535. if ( $null -notmatch $global:WhiteListedAppsRegex -and $item -cmatch $global:WhiteListedAppsRegex ) { $string += " ConflictWhitelist" }
  536. if ( $null -notmatch $Installed -and $Installed -cmatch $item) { $string += "Installed" }
  537. if ( $null -notmatch $AllUsers -and $AllUsers -cmatch $item) { $string += " AllUsers" }
  538. if ( $null -notmatch $Online -and $Online -cmatch $item) { $string += " Online" }
  539. $string += " NON-REMOVABLE"
  540. AddAppToCustomizeForm $checkboxCounter $item $true $false $false $string
  541. ++$checkboxCounter
  542. }
  543. ForEach ( $item in $global:WhiteListedApps ) {
  544. $string = ""
  545. if ( $null -notmatch $NonRemovables -and $NonRemovables -cmatch $item ) { $string += " Conflict NonRemovables " }
  546. if ( $null -notmatch $global:BloatwareRegex -and $item -cmatch $global:BloatwareRegex ) { $string += " ConflictBlacklist " }
  547. if ( $null -notmatch $Installed -and $Installed -cmatch $item) { $string += "Installed" }
  548. if ( $null -notmatch $AllUsers -and $AllUsers -cmatch $item) { $string += " AllUsers" }
  549. if ( $null -notmatch $Online -and $Online -cmatch $item) { $string += " Online" }
  550. AddAppToCustomizeForm $checkboxCounter $item $true $false $true $string
  551. ++$checkboxCounter
  552. }
  553. ForEach ( $item in $global:Bloatware ) {
  554. $string = ""
  555. if ( $null -notmatch $NonRemovables -and $NonRemovables -cmatch $item ) { $string += " Conflict NonRemovables " }
  556. if ( $null -notmatch $global:WhiteListedAppsRegex -and $item -cmatch $global:WhiteListedAppsRegex ) { $string += " Conflict Whitelist " }
  557. if ( $null -notmatch $Installed -and $Installed -cmatch $item) { $string += "Installed" }
  558. if ( $null -notmatch $AllUsers -and $AllUsers -cmatch $item) { $string += " AllUsers" }
  559. if ( $null -notmatch $Online -and $Online -cmatch $item) { $string += " Online" }
  560. AddAppToCustomizeForm $checkboxCounter $item $true $true $true $string
  561. ++$checkboxCounter
  562. }
  563. ForEach ( $item in $AllUsers ) {
  564. $string = "NEW AllUsers"
  565. if ( $null -notmatch $NonRemovables -and $NonRemovables -cmatch $item ) { continue }
  566. if ( $null -notmatch $global:WhiteListedAppsRegex -and $item -cmatch $global:WhiteListedAppsRegex ) { continue }
  567. if ( $null -notmatch $global:BloatwareRegex -and $item -cmatch $global:BloatwareRegex ) { continue }
  568. if ( $null -notmatch $Installed -and $Installed -cmatch $item) { $string += " Installed" }
  569. if ( $null -notmatch $Online -and $Online -cmatch $item) { $string += " Online" }
  570. AddAppToCustomizeForm $checkboxCounter $item $true $true $true $string
  571. ++$checkboxCounter
  572. }
  573. ForEach ( $item in $Installed ) {
  574. $string = "NEW Installed"
  575. if ( $null -notmatch $NonRemovables -and $NonRemovables -cmatch $item ) { continue }
  576. if ( $null -notmatch $global:WhiteListedAppsRegex -and $item -cmatch $global:WhiteListedAppsRegex ) { continue }
  577. if ( $null -notmatch $global:BloatwareRegex -and $item -cmatch $global:BloatwareRegex ) { continue }
  578. if ( $null -notmatch $AllUsers -and $AllUsers -cmatch $item) { continue }
  579. if ( $null -notmatch $Online -and $Online -cmatch $item) { $string += " Online" }
  580. AddAppToCustomizeForm $checkboxCounter $item $true $true $true $string
  581. ++$checkboxCounter
  582. }
  583. ForEach ( $item in $Online ) {
  584. $string = "NEW Online "
  585. if ( $null -notmatch $NonRemovables -and $NonRemovables -cmatch $item ) { continue }
  586. if ( $null -notmatch $global:WhiteListedAppsRegex -and $item -cmatch $global:WhiteListedAppsRegex ) { continue }
  587. if ( $null -notmatch $global:BloatwareRegex -and $item -cmatch $global:BloatwareRegex ) { continue }
  588. if ( $null -notmatch $Installed -and $Installed -cmatch $item) { continue }
  589. if ( $null -notmatch $AllUsers -and $AllUsers -cmatch $item) { continue }
  590. AddAppToCustomizeForm $checkboxCounter $item $true $true $true $string
  591. ++$checkboxCounter
  592. }
  593. [void]$CustomizeForm.ShowDialog()
  594. })
  595. $RemoveBlacklistedBloatware.Add_Click( {
  596. $ErrorActionPreference = 'SilentlyContinue'
  597. Function DebloatBlacklist {
  598. Write-Host "Requesting removal of $global:BloatwareRegex"
  599. Write-Host "--- This may take a while - please be patient ---"
  600. Get-AppxPackage | Where-Object Name -cmatch $global:BloatwareRegex | Remove-AppxPackage
  601. Write-Host "...now starting the silent ProvisionedPackage bloatware removal..."
  602. Get-AppxProvisionedPackage -Online | Where-Object DisplayName -cmatch $global:BloatwareRegex | Remove-AppxProvisionedPackage -Online
  603. Write-Host "...and the final cleanup..."
  604. Get-AppxPackage -AllUsers | Where-Object Name -cmatch $global:BloatwareRegex | Remove-AppxPackage
  605. }
  606. Write-Host "`n`n`n`n`n`n`n`n`n`n`n`n`n`n`n`n`nRemoving blocklisted Bloatware.`n"
  607. DebloatBlacklist
  608. Write-Host "Bloatware removed!"
  609. })
  610. $RemoveAllBloatware.Add_Click( {
  611. $ErrorActionPreference = 'SilentlyContinue'
  612. #This function finds any AppX/AppXProvisioned package and uninstalls it, except for Freshpaint, Windows Calculator, Windows Store, and Windows Photos.
  613. #Also, to note - This does NOT remove essential system services/software/etc such as .NET framework installations, Cortana, Edge, etc.
  614. #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.
  615. Function Begin-SysPrep {
  616. Write-Host "Starting Sysprep Fixes"
  617. # Disable Windows Store Automatic Updates
  618. Write-Host "Adding Registry key to Disable Windows Store Automatic Updates"
  619. $registryPath = "HKLM:\SOFTWARE\Policies\Microsoft\WindowsStore"
  620. If (!(Test-Path $registryPath)) {
  621. Mkdir $registryPath
  622. New-ItemProperty $registryPath AutoDownload -Value 2
  623. }
  624. Set-ItemProperty $registryPath AutoDownload -Value 2
  625. #Stop WindowsStore Installer Service and set to Disabled
  626. Write-Host "Stopping InstallService"
  627. Stop-Service InstallService
  628. Write-Host "Setting InstallService Startup to Disabled"
  629. Set-Service InstallService -StartupType Disabled
  630. }
  631. Function CheckDMWService {
  632. Param([switch]$Debloat)
  633. If (Get-Service dmwappushservice | Where-Object { $_.StartType -eq "Disabled" }) {
  634. Set-Service dmwappushservice -StartupType Automatic
  635. }
  636. If (Get-Service dmwappushservice | Where-Object { $_.Status -eq "Stopped" }) {
  637. Start-Service dmwappushservice
  638. }
  639. }
  640. Function DebloatAll {
  641. #Removes AppxPackages
  642. Get-AppxPackage | Where { !($_.Name -cmatch $global:WhiteListedAppsRegex) -and !($NonRemovables -cmatch $_.Name) } | Remove-AppxPackage
  643. Get-AppxProvisionedPackage -Online | Where { !($_.DisplayName -cmatch $global:WhiteListedAppsRegex) -and !($NonRemovables -cmatch $_.DisplayName) } | Remove-AppxProvisionedPackage -Online
  644. Get-AppxPackage -AllUsers | Where { !($_.Name -cmatch $global:WhiteListedAppsRegex) -and !($NonRemovables -cmatch $_.Name) } | Remove-AppxPackage
  645. }
  646. #Creates a PSDrive to be able to access the 'HKCR' tree
  647. New-PSDrive -Name HKCR -PSProvider Registry -Root HKEY_CLASSES_ROOT
  648. Function Remove-Keys {
  649. #These are the registry keys that it will delete.
  650. $Keys = @(
  651. #Remove Background Tasks
  652. "HKCR:\Extensions\ContractId\Windows.BackgroundTasks\PackageId\46928bounde.EclipseManager_2.2.4.51_neutral__a5h4egax66k6y"
  653. "HKCR:\Extensions\ContractId\Windows.BackgroundTasks\PackageId\ActiproSoftwareLLC.562882FEEB491_2.6.18.18_neutral__24pqs290vpjk0"
  654. "HKCR:\Extensions\ContractId\Windows.BackgroundTasks\PackageId\Microsoft.MicrosoftOfficeHub_17.7909.7600.0_x64__8wekyb3d8bbwe"
  655. "HKCR:\Extensions\ContractId\Windows.BackgroundTasks\PackageId\Microsoft.PPIProjection_10.0.15063.0_neutral_neutral_cw5n1h2txyewy"
  656. "HKCR:\Extensions\ContractId\Windows.BackgroundTasks\PackageId\Microsoft.XboxGameCallableUI_1000.15063.0.0_neutral_neutral_cw5n1h2txyewy"
  657. "HKCR:\Extensions\ContractId\Windows.BackgroundTasks\PackageId\Microsoft.XboxGameCallableUI_1000.16299.15.0_neutral_neutral_cw5n1h2txyewy"
  658. #Windows File
  659. "HKCR:\Extensions\ContractId\Windows.File\PackageId\ActiproSoftwareLLC.562882FEEB491_2.6.18.18_neutral__24pqs290vpjk0"
  660. #Registry keys to delete if they aren't uninstalled by RemoveAppXPackage/RemoveAppXProvisionedPackage
  661. "HKCR:\Extensions\ContractId\Windows.Launch\PackageId\46928bounde.EclipseManager_2.2.4.51_neutral__a5h4egax66k6y"
  662. "HKCR:\Extensions\ContractId\Windows.Launch\PackageId\ActiproSoftwareLLC.562882FEEB491_2.6.18.18_neutral__24pqs290vpjk0"
  663. "HKCR:\Extensions\ContractId\Windows.Launch\PackageId\Microsoft.PPIProjection_10.0.15063.0_neutral_neutral_cw5n1h2txyewy"
  664. "HKCR:\Extensions\ContractId\Windows.Launch\PackageId\Microsoft.XboxGameCallableUI_1000.15063.0.0_neutral_neutral_cw5n1h2txyewy"
  665. "HKCR:\Extensions\ContractId\Windows.Launch\PackageId\Microsoft.XboxGameCallableUI_1000.16299.15.0_neutral_neutral_cw5n1h2txyewy"
  666. #Scheduled Tasks to delete
  667. "HKCR:\Extensions\ContractId\Windows.PreInstalledConfigTask\PackageId\Microsoft.MicrosoftOfficeHub_17.7909.7600.0_x64__8wekyb3d8bbwe"
  668. #Windows Protocol Keys
  669. "HKCR:\Extensions\ContractId\Windows.Protocol\PackageId\ActiproSoftwareLLC.562882FEEB491_2.6.18.18_neutral__24pqs290vpjk0"
  670. "HKCR:\Extensions\ContractId\Windows.Protocol\PackageId\Microsoft.PPIProjection_10.0.15063.0_neutral_neutral_cw5n1h2txyewy"
  671. "HKCR:\Extensions\ContractId\Windows.Protocol\PackageId\Microsoft.XboxGameCallableUI_1000.15063.0.0_neutral_neutral_cw5n1h2txyewy"
  672. "HKCR:\Extensions\ContractId\Windows.Protocol\PackageId\Microsoft.XboxGameCallableUI_1000.16299.15.0_neutral_neutral_cw5n1h2txyewy"
  673. #Windows Share Target
  674. "HKCR:\Extensions\ContractId\Windows.ShareTarget\PackageId\ActiproSoftwareLLC.562882FEEB491_2.6.18.18_neutral__24pqs290vpjk0"
  675. )
  676. #This writes the output of each key it is removing and also removes the keys listed above.
  677. ForEach ($Key in $Keys) {
  678. Write-Host "Removing $Key from registry"
  679. Remove-Item $Key -Recurse
  680. }
  681. }
  682. Function Protect-Privacy {
  683. #Creates a PSDrive to be able to access the 'HKCR' tree
  684. New-PSDrive -Name HKCR -PSProvider Registry -Root HKEY_CLASSES_ROOT
  685. #Disables Windows Feedback Experience
  686. Write-Host "Disabling Windows Feedback Experience program"
  687. $Advertising = 'HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\AdvertisingInfo'
  688. If (Test-Path $Advertising) {
  689. Set-ItemProperty $Advertising Enabled -Value 0
  690. }
  691. #Stops Cortana from being used as part of your Windows Search Function
  692. Write-Host "Stopping Cortana from being used as part of your Windows Search Function"
  693. $Search = 'HKLM:\SOFTWARE\Policies\Microsoft\Windows\Windows Search'
  694. If (Test-Path $Search) {
  695. Set-ItemProperty $Search AllowCortana -Value 0
  696. }
  697. #Stops the Windows Feedback Experience from sending anonymous data
  698. Write-Host "Stopping the Windows Feedback Experience program"
  699. $Period1 = 'HKCU:\Software\Microsoft\Siuf'
  700. $Period2 = 'HKCU:\Software\Microsoft\Siuf\Rules'
  701. $Period3 = 'HKCU:\Software\Microsoft\Siuf\Rules\PeriodInNanoSeconds'
  702. If (!(Test-Path $Period3)) {
  703. mkdir $Period1
  704. mkdir $Period2
  705. mkdir $Period3
  706. New-ItemProperty $Period3 PeriodInNanoSeconds -Value 0
  707. }
  708. Write-Host "Adding Registry key to prevent bloatware apps from returning"
  709. #Prevents bloatware applications from returning
  710. $registryPath = "HKLM:\SOFTWARE\Policies\Microsoft\Windows\CloudContent"
  711. If (!(Test-Path $registryPath)) {
  712. Mkdir $registryPath
  713. New-ItemProperty $registryPath DisableWindowsConsumerFeatures -Value 1
  714. }
  715. Write-Host "Setting Mixed Reality Portal value to 0 so that you can uninstall it in Settings"
  716. $Holo = 'HKCU:\Software\Microsoft\Windows\CurrentVersion\Holographic'
  717. If (Test-Path $Holo) {
  718. Set-ItemProperty $Holo FirstRunSucceeded -Value 0
  719. }
  720. #Disables live tiles
  721. Write-Host "Disabling live tiles"
  722. $Live = 'HKCU:\SOFTWARE\Policies\Microsoft\Windows\CurrentVersion\PushNotifications'
  723. If (!(Test-Path $Live)) {
  724. mkdir $Live
  725. New-ItemProperty $Live NoTileApplicationNotification -Value 1
  726. }
  727. #Turns off Data Collection via the AllowTelemtry key by changing it to 0
  728. Write-Host "Turning off Data Collection"
  729. $DataCollection = 'HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\Policies\DataCollection'
  730. If (Test-Path $DataCollection) {
  731. Set-ItemProperty $DataCollection AllowTelemetry -Value 0
  732. }
  733. #Disables People icon on Taskbar
  734. Write-Host "Disabling People icon on Taskbar"
  735. $People = 'HKCU:\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\Advanced\People'
  736. If (Test-Path $People) {
  737. Set-ItemProperty $People PeopleBand -Value 0
  738. }
  739. #Disables suggestions on start menu
  740. Write-Host "Disabling suggestions on the Start Menu"
  741. $Suggestions = 'HKCU:\Software\Microsoft\Windows\CurrentVersion\ContentDeliveryManager'
  742. If (Test-Path $Suggestions) {
  743. Set-ItemProperty $Suggestions SystemPaneSuggestionsEnabled -Value 0
  744. }
  745. Write-Host "Removing CloudStore from registry if it exists"
  746. $CloudStore = 'HKCU:\Software\Microsoft\Windows\CurrentVersion\CloudStore'
  747. If (Test-Path $CloudStore) {
  748. Stop-Process Explorer.exe -Force
  749. Remove-Item $CloudStore -Recurse -Force
  750. Start-Process Explorer.exe -Wait
  751. }
  752. #Loads the registry keys/values below into the NTUSER.DAT file which prevents the apps from redownloading. Credit to a60wattfish
  753. reg load HKU\Default_User C:\Users\Default\NTUSER.DAT
  754. Set-ItemProperty -Path Registry::HKU\Default_User\SOFTWARE\Microsoft\Windows\CurrentVersion\ContentDeliveryManager -Name SystemPaneSuggestionsEnabled -Value 0
  755. Set-ItemProperty -Path Registry::HKU\Default_User\SOFTWARE\Microsoft\Windows\CurrentVersion\ContentDeliveryManager -Name PreInstalledAppsEnabled -Value 0
  756. Set-ItemProperty -Path Registry::HKU\Default_User\SOFTWARE\Microsoft\Windows\CurrentVersion\ContentDeliveryManager -Name OemPreInstalledAppsEnabled -Value 0
  757. reg unload HKU\Default_User
  758. #Disables scheduled tasks that are considered unnecessary
  759. Write-Host "Disabling scheduled tasks"
  760. #Get-ScheduledTask -TaskName XblGameSaveTaskLogon | Disable-ScheduledTask
  761. Get-ScheduledTask -TaskName XblGameSaveTask | Disable-ScheduledTask
  762. Get-ScheduledTask -TaskName Consolidator | Disable-ScheduledTask
  763. Get-ScheduledTask -TaskName UsbCeip | Disable-ScheduledTask
  764. Get-ScheduledTask -TaskName DmClient | Disable-ScheduledTask
  765. Get-ScheduledTask -TaskName DmClientOnScenarioDownload | Disable-ScheduledTask
  766. }
  767. Function UnpinStart {
  768. # https://superuser.com/a/1442733
  769. # Requires -RunAsAdministrator
  770. $START_MENU_LAYOUT = @"
  771. <LayoutModificationTemplate xmlns:defaultlayout="http://schemas.microsoft.com/Start/2014/FullDefaultLayout" xmlns:start="http://schemas.microsoft.com/Start/2014/StartLayout" Version="1" xmlns:taskbar="http://schemas.microsoft.com/Start/2014/TaskbarLayout" xmlns="http://schemas.microsoft.com/Start/2014/LayoutModification">
  772. <LayoutOptions StartTileGroupCellWidth="6" />
  773. <DefaultLayoutOverride>
  774. <StartLayoutCollection>
  775. <defaultlayout:StartLayout GroupCellWidth="6" />
  776. </StartLayoutCollection>
  777. </DefaultLayoutOverride>
  778. </LayoutModificationTemplate>
  779. "@
  780. $layoutFile="C:\Windows\StartMenuLayout.xml"
  781. #Delete layout file if it already exists
  782. If(Test-Path $layoutFile)
  783. {
  784. Remove-Item $layoutFile
  785. }
  786. #Creates the blank layout file
  787. $START_MENU_LAYOUT | Out-File $layoutFile -Encoding ASCII
  788. $regAliases = @("HKLM", "HKCU")
  789. #Assign the start layout and force it to apply with "LockedStartLayout" at both the machine and user level
  790. foreach ($regAlias in $regAliases){
  791. $basePath = $regAlias + ":\SOFTWARE\Policies\Microsoft\Windows"
  792. $keyPath = $basePath + "\Explorer"
  793. IF(!(Test-Path -Path $keyPath)) {
  794. New-Item -Path $basePath -Name "Explorer"
  795. }
  796. Set-ItemProperty -Path $keyPath -Name "LockedStartLayout" -Value 1
  797. Set-ItemProperty -Path $keyPath -Name "StartLayoutFile" -Value $layoutFile
  798. }
  799. #Restart Explorer, open the start menu (necessary to load the new layout), and give it a few seconds to process
  800. Stop-Process -name explorer
  801. Start-Sleep -s 5
  802. $wshell = New-Object -ComObject wscript.shell; $wshell.SendKeys('^{ESCAPE}')
  803. Start-Sleep -s 5
  804. #Enable the ability to pin items again by disabling "LockedStartLayout"
  805. foreach ($regAlias in $regAliases){
  806. $basePath = $regAlias + ":\SOFTWARE\Policies\Microsoft\Windows"
  807. $keyPath = $basePath + "\Explorer"
  808. Set-ItemProperty -Path $keyPath -Name "LockedStartLayout" -Value 0
  809. }
  810. #Restart Explorer and delete the layout file
  811. Stop-Process -name explorer
  812. # Uncomment the next line to make clean start menu default for all new users
  813. #Import-StartLayout -LayoutPath $layoutFile -MountPath $env:SystemDrive\
  814. Remove-Item $layoutFile
  815. }
  816. Function CheckInstallService {
  817. If (Get-Service InstallService | Where-Object { $_.Status -eq "Stopped" }) {
  818. Start-Service InstallService
  819. Set-Service InstallService -StartupType Automatic
  820. }
  821. }
  822. Write-Host "Initiating Sysprep"
  823. Begin-SysPrep
  824. Write-Host "Removing bloatware apps."
  825. DebloatAll
  826. Write-Host "Removing leftover bloatware registry keys."
  827. Remove-Keys
  828. Write-Host "Checking to see if any Allowlisted Apps were removed, and if so re-adding them."
  829. FixWhitelistedApps
  830. Write-Host "Stopping telemetry, disabling unneccessary scheduled tasks, and preventing bloatware from returning."
  831. Protect-Privacy
  832. Write-Host "Unpinning tiles from the Start Menu."
  833. UnpinStart
  834. Write-Host "Setting the 'InstallService' Windows service back to 'Started' and the Startup Type 'Automatic'."
  835. CheckDMWService
  836. CheckInstallService
  837. Write-Host "Finished all tasks. `n"
  838. } )
  839. $RevertChanges.Add_Click( {
  840. $ErrorActionPreference = 'SilentlyContinue'
  841. #This function will revert the changes you made when running the Start-Debloat function.
  842. #This line reinstalls all of the bloatware that was removed
  843. Get-AppxPackage -AllUsers | ForEach { Add-AppxPackage -Verbose -DisableDevelopmentMode -Register "$($_.InstallLocation)\AppXManifest.xml" }
  844. #Tells Windows to enable your advertising information.
  845. Write-Host "Re-enabling key to show advertisement information"
  846. $Advertising = "HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\AdvertisingInfo"
  847. If (Test-Path $Advertising) {
  848. Set-ItemProperty $Advertising Enabled -Value 1
  849. }
  850. #Enables Cortana to be used as part of your Windows Search Function
  851. Write-Host "Re-enabling Cortana to be used in your Windows Search"
  852. $Search = "HKLM:\SOFTWARE\Policies\Microsoft\Windows\Windows Search"
  853. If (Test-Path $Search) {
  854. Set-ItemProperty $Search AllowCortana -Value 1
  855. }
  856. #Re-enables the Windows Feedback Experience for sending anonymous data
  857. Write-Host "Re-enabling Windows Feedback Experience"
  858. $Period = "HKCU:\Software\Microsoft\Siuf\Rules"
  859. If (!(Test-Path $Period)) {
  860. New-Item $Period
  861. }
  862. Set-ItemProperty $Period PeriodInNanoSeconds -Value 1
  863. #Enables bloatware applications
  864. Write-Host "Adding Registry key to allow bloatware apps to return"
  865. $registryPath = "HKLM:\SOFTWARE\Policies\Microsoft\Windows\CloudContent"
  866. If (!(Test-Path $registryPath)) {
  867. New-Item $registryPath
  868. }
  869. Set-ItemProperty $registryPath DisableWindowsConsumerFeatures -Value 0
  870. #Changes Mixed Reality Portal Key 'FirstRunSucceeded' to 1
  871. Write-Host "Setting Mixed Reality Portal value to 1"
  872. $Holo = "HKCU:\Software\Microsoft\Windows\CurrentVersion\Holographic"
  873. If (Test-Path $Holo) {
  874. Set-ItemProperty $Holo FirstRunSucceeded -Value 1
  875. }
  876. #Re-enables live tiles
  877. Write-Host "Enabling live tiles"
  878. $Live = "HKCU:\SOFTWARE\Policies\Microsoft\Windows\CurrentVersion\PushNotifications"
  879. If (!(Test-Path $Live)) {
  880. New-Item $Live
  881. }
  882. Set-ItemProperty $Live NoTileApplicationNotification -Value 0
  883. #Re-enables data collection
  884. Write-Host "Re-enabling data collection"
  885. $DataCollection = "HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\Policies\DataCollection"
  886. If (!(Test-Path $DataCollection)) {
  887. New-Item $DataCollection
  888. }
  889. Set-ItemProperty $DataCollection AllowTelemetry -Value 1
  890. #Re-enables People Icon on Taskbar
  891. Write-Host "Enabling People Icon on Taskbar"
  892. $People = 'HKCU:\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\Advanced\People'
  893. If (Test-Path $People) {
  894. Set-ItemProperty $People -Name PeopleBand -Value 1 -Verbose
  895. }
  896. #Re-enables suggestions on start menu
  897. Write-Host "Enabling suggestions on the Start Menu"
  898. $Suggestions = "HKCU:\Software\Microsoft\Windows\CurrentVersion\ContentDeliveryManager"
  899. If (!(Test-Path $Suggestions)) {
  900. New-Item $Suggestions
  901. }
  902. Set-ItemProperty $Suggestions SystemPaneSuggestionsEnabled -Value 1
  903. #Re-enables scheduled tasks that were disabled when running the Debloat switch
  904. Write-Host "Enabling scheduled tasks that were disabled"
  905. Get-ScheduledTask XblGameSaveTaskLogon | Enable-ScheduledTask
  906. Get-ScheduledTask XblGameSaveTask | Enable-ScheduledTask
  907. Get-ScheduledTask Consolidator | Enable-ScheduledTask
  908. Get-ScheduledTask UsbCeip | Enable-ScheduledTask
  909. Get-ScheduledTask DmClient | Enable-ScheduledTask
  910. Get-ScheduledTask DmClientOnScenarioDownload | Enable-ScheduledTask
  911. Write-Host "Re-enabling and starting WAP Push Service"
  912. #Enable and start WAP Push Service
  913. Set-Service "dmwappushservice" -StartupType Automatic
  914. Start-Service "dmwappushservice"
  915. Write-Host "Re-enabling and starting the Diagnostics Tracking Service"
  916. #Enabling the Diagnostics Tracking Service
  917. Set-Service "DiagTrack" -StartupType Automatic
  918. Start-Service "DiagTrack"
  919. Write-Host "Done reverting changes!"
  920. #
  921. Write-Output "Restoring 3D Objects from Explorer 'My Computer' submenu"
  922. $Objects32 = "HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\MyComputer\NameSpace\{0DB7E03F-FC29-4DC6-9020-FF41B59E513A}"
  923. $Objects64 = "HKLM:\SOFTWARE\WOW6432Node\Microsoft\Windows\CurrentVersion\Explorer\MyComputer\NameSpace\{0DB7E03F-FC29-4DC6-9020-FF41B59E513A}"
  924. If (!(Test-Path $Objects32)) {
  925. New-Item $Objects32
  926. }
  927. If (!(Test-Path $Objects64)) {
  928. New-Item $Objects64
  929. }
  930. })
  931. $DisableCortana.Add_Click( {
  932. $ErrorActionPreference = 'SilentlyContinue'
  933. Write-Host "Disabling Cortana"
  934. $Cortana1 = "HKCU:\SOFTWARE\Microsoft\Personalization\Settings"
  935. $Cortana2 = "HKCU:\SOFTWARE\Microsoft\InputPersonalization"
  936. $Cortana3 = "HKCU:\SOFTWARE\Microsoft\InputPersonalization\TrainedDataStore"
  937. If (!(Test-Path $Cortana1)) {
  938. New-Item $Cortana1
  939. }
  940. Set-ItemProperty $Cortana1 AcceptedPrivacyPolicy -Value 0
  941. If (!(Test-Path $Cortana2)) {
  942. New-Item $Cortana2
  943. }
  944. Set-ItemProperty $Cortana2 RestrictImplicitTextCollection -Value 1
  945. Set-ItemProperty $Cortana2 RestrictImplicitInkCollection -Value 1
  946. If (!(Test-Path $Cortana3)) {
  947. New-Item $Cortana3
  948. }
  949. Set-ItemProperty $Cortana3 HarvestContacts -Value 0
  950. Write-Host "Cortana has been disabled."
  951. })
  952. $DisableEdgePDFTakeover.Add_Click( {
  953. $ErrorActionPreference = 'SilentlyContinue'
  954. #Stops edge from taking over as the default .PDF viewer
  955. Write-Host "Stopping Edge from taking over as the default .PDF viewer"
  956. $NoPDF = "HKCR:\.pdf"
  957. $NoProgids = "HKCR:\.pdf\OpenWithProgids"
  958. $NoWithList = "HKCR:\.pdf\OpenWithList"
  959. If (!(Get-ItemProperty $NoPDF NoOpenWith)) {
  960. New-ItemProperty $NoPDF NoOpenWith
  961. }
  962. If (!(Get-ItemProperty $NoPDF NoStaticDefaultVerb)) {
  963. New-ItemProperty $NoPDF NoStaticDefaultVerb
  964. }
  965. If (!(Get-ItemProperty $NoProgids NoOpenWith)) {
  966. New-ItemProperty $NoProgids NoOpenWith
  967. }
  968. If (!(Get-ItemProperty $NoProgids NoStaticDefaultVerb)) {
  969. New-ItemProperty $NoProgids NoStaticDefaultVerb
  970. }
  971. If (!(Get-ItemProperty $NoWithList NoOpenWith)) {
  972. New-ItemProperty $NoWithList NoOpenWith
  973. }
  974. If (!(Get-ItemProperty $NoWithList NoStaticDefaultVerb)) {
  975. New-ItemProperty $NoWithList NoStaticDefaultVerb
  976. }
  977. #Appends an underscore '_' to the Registry key for Edge
  978. $Edge = "HKCR:\AppXd4nrz8ff68srnhf9t5a8sbjyar1cr723_"
  979. If (Test-Path $Edge) {
  980. Set-Item $Edge AppXd4nrz8ff68srnhf9t5a8sbjyar1cr723_
  981. }
  982. Write-Host "Edge should no longer take over as the default .PDF."
  983. })
  984. $EnableCortana.Add_Click( {
  985. $ErrorActionPreference = 'SilentlyContinue'
  986. Write-Host "Re-enabling Cortana"
  987. $Cortana1 = "HKCU:\SOFTWARE\Microsoft\Personalization\Settings"
  988. $Cortana2 = "HKCU:\SOFTWARE\Microsoft\InputPersonalization"
  989. $Cortana3 = "HKCU:\SOFTWARE\Microsoft\InputPersonalization\TrainedDataStore"
  990. If (!(Test-Path $Cortana1)) {
  991. New-Item $Cortana1
  992. }
  993. Set-ItemProperty $Cortana1 AcceptedPrivacyPolicy -Value 1
  994. If (!(Test-Path $Cortana2)) {
  995. New-Item $Cortana2
  996. }
  997. Set-ItemProperty $Cortana2 RestrictImplicitTextCollection -Value 0
  998. Set-ItemProperty $Cortana2 RestrictImplicitInkCollection -Value 0
  999. If (!(Test-Path $Cortana3)) {
  1000. New-Item $Cortana3
  1001. }
  1002. Set-ItemProperty $Cortana3 HarvestContacts -Value 1
  1003. Write-Host "Cortana has been enabled!"
  1004. })
  1005. $EnableEdgePDFTakeover.Add_Click( {
  1006. New-PSDrive HKCR -PSProvider Registry -Root HKEY_CLASSES_ROOT
  1007. $ErrorActionPreference = 'SilentlyContinue'
  1008. Write-Host "Setting Edge back to default"
  1009. $NoPDF = "HKCR:\.pdf"
  1010. $NoProgids = "HKCR:\.pdf\OpenWithProgids"
  1011. $NoWithList = "HKCR:\.pdf\OpenWithList"
  1012. #Sets edge back to default
  1013. If (Get-ItemProperty $NoPDF NoOpenWith) {
  1014. Remove-ItemProperty $NoPDF NoOpenWith
  1015. }
  1016. If (Get-ItemProperty $NoPDF NoStaticDefaultVerb) {
  1017. Remove-ItemProperty $NoPDF NoStaticDefaultVerb
  1018. }
  1019. If (Get-ItemProperty $NoProgids NoOpenWith) {
  1020. Remove-ItemProperty $NoProgids NoOpenWith
  1021. }
  1022. If (Get-ItemProperty $NoProgids NoStaticDefaultVerb) {
  1023. Remove-ItemProperty $NoProgids NoStaticDefaultVerb
  1024. }
  1025. If (Get-ItemProperty $NoWithList NoOpenWith) {
  1026. Remove-ItemProperty $NoWithList NoOpenWith
  1027. }
  1028. If (Get-ItemProperty $NoWithList NoStaticDefaultVerb) {
  1029. Remove-ItemProperty $NoWithList NoStaticDefaultVerb
  1030. }
  1031. #Removes an underscore '_' from the Registry key for Edge
  1032. $Edge2 = "HKCR:\AppXd4nrz8ff68srnhf9t5a8sbjyar1cr723_"
  1033. If (Test-Path $Edge2) {
  1034. Set-Item $Edge2 AppXd4nrz8ff68srnhf9t5a8sbjyar1cr723
  1035. }
  1036. Write-Host "Edge will now be able to be used for .PDF."
  1037. })
  1038. $DisableTelemetry.Add_Click( {
  1039. $ErrorActionPreference = 'SilentlyContinue'
  1040. #Disables Windows Feedback Experience
  1041. Write-Host "Disabling Windows Feedback Experience program"
  1042. $Advertising = "HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\AdvertisingInfo"
  1043. If (Test-Path $Advertising) {
  1044. Set-ItemProperty $Advertising Enabled -Value 0
  1045. }
  1046. #Stops Cortana from being used as part of your Windows Search Function
  1047. Write-Host "Stopping Cortana from being used as part of your Windows Search Function"
  1048. $Search = "HKLM:\SOFTWARE\Policies\Microsoft\Windows\Windows Search"
  1049. If (Test-Path $Search) {
  1050. Set-ItemProperty $Search AllowCortana -Value 0
  1051. }
  1052. #Disables Web Search in Start Menu
  1053. Write-Host "Disabling Bing Search in Start Menu"
  1054. $WebSearch = "HKLM:\SOFTWARE\Policies\Microsoft\Windows\Windows Search"
  1055. Set-ItemProperty "HKCU:\SOFTWARE\Microsoft\Windows\CurrentVersion\Search" BingSearchEnabled -Value 0
  1056. If (!(Test-Path $WebSearch)) {
  1057. New-Item $WebSearch
  1058. }
  1059. Set-ItemProperty $WebSearch DisableWebSearch -Value 1
  1060. #Stops the Windows Feedback Experience from sending anonymous data
  1061. Write-Host "Stopping the Windows Feedback Experience program"
  1062. $Period = "HKCU:\Software\Microsoft\Siuf\Rules"
  1063. If (!(Test-Path $Period)) {
  1064. New-Item $Period
  1065. }
  1066. Set-ItemProperty $Period PeriodInNanoSeconds -Value 0
  1067. #Prevents bloatware applications from returning and removes Start Menu suggestions
  1068. Write-Host "Adding Registry key to prevent bloatware apps from returning"
  1069. $registryPath = "HKLM:\SOFTWARE\Policies\Microsoft\Windows\CloudContent"
  1070. $registryOEM = "HKCU:\SOFTWARE\Microsoft\Windows\CurrentVersion\ContentDeliveryManager"
  1071. If (!(Test-Path $registryPath)) {
  1072. New-Item $registryPath
  1073. }
  1074. Set-ItemProperty $registryPath DisableWindowsConsumerFeatures -Value 1
  1075. If (!(Test-Path $registryOEM)) {
  1076. New-Item $registryOEM
  1077. }
  1078. Set-ItemProperty $registryOEM ContentDeliveryAllowed -Value 0
  1079. Set-ItemProperty $registryOEM OemPreInstalledAppsEnabled -Value 0
  1080. Set-ItemProperty $registryOEM PreInstalledAppsEnabled -Value 0
  1081. Set-ItemProperty $registryOEM PreInstalledAppsEverEnabled -Value 0
  1082. Set-ItemProperty $registryOEM SilentInstalledAppsEnabled -Value 0
  1083. Set-ItemProperty $registryOEM SystemPaneSuggestionsEnabled -Value 0
  1084. #Preping mixed Reality Portal for removal
  1085. Write-Host "Setting Mixed Reality Portal value to 0 so that you can uninstall it in Settings"
  1086. $Holo = "HKCU:\Software\Microsoft\Windows\CurrentVersion\Holographic"
  1087. If (Test-Path $Holo) {
  1088. Set-ItemProperty $Holo FirstRunSucceeded -Value 0
  1089. }
  1090. #Disables Wi-fi Sense
  1091. Write-Host "Disabling Wi-Fi Sense"
  1092. $WifiSense1 = "HKLM:\SOFTWARE\Microsoft\PolicyManager\default\WiFi\AllowWiFiHotSpotReporting"
  1093. $WifiSense2 = "HKLM:\SOFTWARE\Microsoft\PolicyManager\default\WiFi\AllowAutoConnectToWiFiSenseHotspots"
  1094. $WifiSense3 = "HKLM:\SOFTWARE\Microsoft\WcmSvc\wifinetworkmanager\config"
  1095. If (!(Test-Path $WifiSense1)) {
  1096. New-Item $WifiSense1
  1097. }
  1098. Set-ItemProperty $WifiSense1 Value -Value 0
  1099. If (!(Test-Path $WifiSense2)) {
  1100. New-Item $WifiSense2
  1101. }
  1102. Set-ItemProperty $WifiSense2 Value -Value 0
  1103. Set-ItemProperty $WifiSense3 AutoConnectAllowedOEM -Value 0
  1104. #Disables live tiles
  1105. Write-Host "Disabling live tiles"
  1106. $Live = "HKCU:\SOFTWARE\Policies\Microsoft\Windows\CurrentVersion\PushNotifications"
  1107. If (!(Test-Path $Live)) {
  1108. New-Item $Live
  1109. }
  1110. Set-ItemProperty $Live NoTileApplicationNotification -Value 1
  1111. #Turns off Data Collection via the AllowTelemtry key by changing it to 0
  1112. Write-Host "Turning off Data Collection"
  1113. $DataCollection1 = "HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\Policies\DataCollection"
  1114. $DataCollection2 = "HKLM:\SOFTWARE\Policies\Microsoft\Windows\DataCollection"
  1115. $DataCollection3 = "HKLM:\SOFTWARE\Wow6432Node\Microsoft\Windows\CurrentVersion\Policies\DataCollection"
  1116. If (Test-Path $DataCollection1) {
  1117. Set-ItemProperty $DataCollection1 AllowTelemetry -Value 0
  1118. }
  1119. If (Test-Path $DataCollection2) {
  1120. Set-ItemProperty $DataCollection2 AllowTelemetry -Value 0
  1121. }
  1122. If (Test-Path $DataCollection3) {
  1123. Set-ItemProperty $DataCollection3 AllowTelemetry -Value 0
  1124. }
  1125. #Disabling Location Tracking
  1126. Write-Host "Disabling Location Tracking"
  1127. $SensorState = "HKLM:\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Sensor\Overrides\{BFA794E4-F964-4FDB-90F6-51056BFE4B44}"
  1128. $LocationConfig = "HKLM:\SYSTEM\CurrentControlSet\Services\lfsvc\Service\Configuration"
  1129. If (!(Test-Path $SensorState)) {
  1130. New-Item $SensorState
  1131. }
  1132. Set-ItemProperty $SensorState SensorPermissionState -Value 0
  1133. If (!(Test-Path $LocationConfig)) {
  1134. New-Item $LocationConfig
  1135. }
  1136. Set-ItemProperty $LocationConfig Status -Value 0
  1137. #Disables People icon on Taskbar
  1138. Write-Host "Disabling People icon on Taskbar"
  1139. $People = 'HKCU:\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\Advanced\People'
  1140. If (Test-Path $People) {
  1141. Set-ItemProperty $People -Name PeopleBand -Value 0
  1142. }
  1143. #Disables scheduled tasks that are considered unnecessary
  1144. Write-Host "Disabling scheduled tasks"
  1145. #Get-ScheduledTask XblGameSaveTaskLogon | Disable-ScheduledTask
  1146. Get-ScheduledTask XblGameSaveTask | Disable-ScheduledTask
  1147. Get-ScheduledTask Consolidator | Disable-ScheduledTask
  1148. Get-ScheduledTask UsbCeip | Disable-ScheduledTask
  1149. Get-ScheduledTask DmClient | Disable-ScheduledTask
  1150. Get-ScheduledTask DmClientOnScenarioDownload | Disable-ScheduledTask
  1151. #Write-Host "Uninstalling Telemetry Windows Updates"
  1152. #Uninstalls Some Windows Updates considered to be Telemetry. !WIP!
  1153. #Wusa /Uninstall /KB:3022345 /norestart /quiet
  1154. #Wusa /Uninstall /KB:3068708 /norestart /quiet
  1155. #Wusa /Uninstall /KB:3075249 /norestart /quiet
  1156. #Wusa /Uninstall /KB:3080149 /norestart /quiet
  1157. Write-Host "Stopping and disabling WAP Push Service"
  1158. #Stop and disable WAP Push Service
  1159. Stop-Service "dmwappushservice"
  1160. Set-Service "dmwappushservice" -StartupType Disabled
  1161. Write-Host "Stopping and disabling Diagnostics Tracking Service"
  1162. #Disabling the Diagnostics Tracking Service
  1163. Stop-Service "DiagTrack"
  1164. Set-Service "DiagTrack" -StartupType Disabled
  1165. Write-Host "Telemetry has been disabled!"
  1166. })
  1167. $RemoveRegkeys.Add_Click( {
  1168. $ErrorActionPreference = 'SilentlyContinue'
  1169. $Keys = @(
  1170. New-PSDrive HKCR -PSProvider Registry -Root HKEY_CLASSES_ROOT
  1171. #Remove Background Tasks
  1172. "HKCR:\Extensions\ContractId\Windows.BackgroundTasks\PackageId\46928bounde.EclipseManager_2.2.4.51_neutral__a5h4egax66k6y"
  1173. "HKCR:\Extensions\ContractId\Windows.BackgroundTasks\PackageId\ActiproSoftwareLLC.562882FEEB491_2.6.18.18_neutral__24pqs290vpjk0"
  1174. "HKCR:\Extensions\ContractId\Windows.BackgroundTasks\PackageId\Microsoft.MicrosoftOfficeHub_17.7909.7600.0_x64__8wekyb3d8bbwe"
  1175. "HKCR:\Extensions\ContractId\Windows.BackgroundTasks\PackageId\Microsoft.PPIProjection_10.0.15063.0_neutral_neutral_cw5n1h2txyewy"
  1176. "HKCR:\Extensions\ContractId\Windows.BackgroundTasks\PackageId\Microsoft.XboxGameCallableUI_1000.15063.0.0_neutral_neutral_cw5n1h2txyewy"
  1177. "HKCR:\Extensions\ContractId\Windows.BackgroundTasks\PackageId\Microsoft.XboxGameCallableUI_1000.16299.15.0_neutral_neutral_cw5n1h2txyewy"
  1178. #Windows File
  1179. "HKCR:\Extensions\ContractId\Windows.File\PackageId\ActiproSoftwareLLC.562882FEEB491_2.6.18.18_neutral__24pqs290vpjk0"
  1180. #Registry keys to delete if they aren't uninstalled by RemoveAppXPackage/RemoveAppXProvisionedPackage
  1181. "HKCR:\Extensions\ContractId\Windows.Launch\PackageId\46928bounde.EclipseManager_2.2.4.51_neutral__a5h4egax66k6y"
  1182. "HKCR:\Extensions\ContractId\Windows.Launch\PackageId\ActiproSoftwareLLC.562882FEEB491_2.6.18.18_neutral__24pqs290vpjk0"
  1183. "HKCR:\Extensions\ContractId\Windows.Launch\PackageId\Microsoft.PPIProjection_10.0.15063.0_neutral_neutral_cw5n1h2txyewy"
  1184. "HKCR:\Extensions\ContractId\Windows.Launch\PackageId\Microsoft.XboxGameCallableUI_1000.15063.0.0_neutral_neutral_cw5n1h2txyewy"
  1185. "HKCR:\Extensions\ContractId\Windows.Launch\PackageId\Microsoft.XboxGameCallableUI_1000.16299.15.0_neutral_neutral_cw5n1h2txyewy"
  1186. #Scheduled Tasks to delete
  1187. "HKCR:\Extensions\ContractId\Windows.PreInstalledConfigTask\PackageId\Microsoft.MicrosoftOfficeHub_17.7909.7600.0_x64__8wekyb3d8bbwe"
  1188. #Windows Protocol Keys
  1189. "HKCR:\Extensions\ContractId\Windows.Protocol\PackageId\ActiproSoftwareLLC.562882FEEB491_2.6.18.18_neutral__24pqs290vpjk0"
  1190. "HKCR:\Extensions\ContractId\Windows.Protocol\PackageId\Microsoft.PPIProjection_10.0.15063.0_neutral_neutral_cw5n1h2txyewy"
  1191. "HKCR:\Extensions\ContractId\Windows.Protocol\PackageId\Microsoft.XboxGameCallableUI_1000.15063.0.0_neutral_neutral_cw5n1h2txyewy"
  1192. "HKCR:\Extensions\ContractId\Windows.Protocol\PackageId\Microsoft.XboxGameCallableUI_1000.16299.15.0_neutral_neutral_cw5n1h2txyewy"
  1193. #Windows Share Target
  1194. "HKCR:\Extensions\ContractId\Windows.ShareTarget\PackageId\ActiproSoftwareLLC.562882FEEB491_2.6.18.18_neutral__24pqs290vpjk0"
  1195. )
  1196. #This writes the output of each key it is removing and also removes the keys listed above.
  1197. ForEach ($Key in $Keys) {
  1198. Write-Host "Removing $Key from registry"
  1199. Remove-Item $Key -Recurse
  1200. }
  1201. Write-Host "Additional bloatware keys have been removed!"
  1202. })
  1203. $UnpinStartMenuTiles.Add_Click( {
  1204. #https://superuser.com/questions/1068382/how-to-remove-all-the-tiles-in-the-windows-10-start-menu
  1205. #Unpins all tiles from the Start Menu
  1206. Write-Host "Unpinning all tiles from the start menu"
  1207. (New-Object -Com Shell.Application).
  1208. NameSpace('shell:::{4234d49b-0245-4df3-b780-3893943456e1}').
  1209. Items() |
  1210. % { $_.Verbs() } |
  1211. ? { $_.Name -match 'Un.*pin from Start' } |
  1212. % { $_.DoIt() }
  1213. })
  1214. $RemoveOnedrive.Add_Click( {
  1215. If (Test-Path "$env:USERPROFILE\OneDrive\*") {
  1216. Write-Host "Files found within the OneDrive folder! Checking to see if a folder named OneDriveBackupFiles exists."
  1217. Start-Sleep 1
  1218. If (Test-Path "$env:USERPROFILE\Desktop\OneDriveBackupFiles") {
  1219. Write-Host "A folder named OneDriveBackupFiles already exists on your desktop. All files from your OneDrive location will be moved to that folder."
  1220. }
  1221. else {
  1222. If (!(Test-Path "$env:USERPROFILE\Desktop\OneDriveBackupFiles")) {
  1223. 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."
  1224. New-item -Path "$env:USERPROFILE\Desktop" -Name "OneDriveBackupFiles"-ItemType Directory -Force
  1225. Write-Host "Successfully created the folder 'OneDriveBackupFiles' on your desktop."
  1226. }
  1227. }
  1228. Start-Sleep 1
  1229. Move-Item -Path "$env:USERPROFILE\OneDrive\*" -Destination "$env:USERPROFILE\Desktop\OneDriveBackupFiles" -Force
  1230. Write-Host "Successfully moved all files/folders from your OneDrive folder to the folder 'OneDriveBackupFiles' on your desktop."
  1231. Start-Sleep 1
  1232. Write-Host "Proceeding with the removal of OneDrive."
  1233. Start-Sleep 1
  1234. }
  1235. Else {
  1236. 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."
  1237. Start-Sleep 1
  1238. Write-Host "Enabling the Group Policy 'Prevent the usage of OneDrive for File Storage'."
  1239. $OneDriveKey = 'HKLM:Software\Policies\Microsoft\Windows\OneDrive'
  1240. If (!(Test-Path $OneDriveKey)) {
  1241. Mkdir $OneDriveKey
  1242. Set-ItemProperty $OneDriveKey -Name OneDrive -Value DisableFileSyncNGSC
  1243. }
  1244. Set-ItemProperty $OneDriveKey -Name OneDrive -Value DisableFileSyncNGSC
  1245. }
  1246. Write-Host "Uninstalling OneDrive. Please wait..."
  1247. New-PSDrive HKCR -PSProvider Registry -Root HKEY_CLASSES_ROOT
  1248. $onedrive = "$env:SYSTEMROOT\SysWOW64\OneDriveSetup.exe"
  1249. $ExplorerReg1 = "HKCR:\CLSID\{018D5C66-4533-4307-9B53-224DE2ED1FE6}"
  1250. $ExplorerReg2 = "HKCR:\Wow6432Node\CLSID\{018D5C66-4533-4307-9B53-224DE2ED1FE6}"
  1251. Stop-Process -Name "OneDrive*"
  1252. Start-Sleep 2
  1253. If (!(Test-Path $onedrive)) {
  1254. $onedrive = "$env:SYSTEMROOT\System32\OneDriveSetup.exe"
  1255. }
  1256. Start-Process $onedrive "/uninstall" -NoNewWindow -Wait
  1257. Start-Sleep 2
  1258. Write-Host "Stopping explorer"
  1259. Start-Sleep 1
  1260. taskkill.exe /F /IM explorer.exe
  1261. Start-Sleep 3
  1262. Write-Host "Removing leftover files"
  1263. If (Test-Path "$env:USERPROFILE\OneDrive") {
  1264. Remove-Item "$env:USERPROFILE\OneDrive" -Force -Recurse
  1265. }
  1266. If (Test-Path "$env:LOCALAPPDATA\Microsoft\OneDrive") {
  1267. Remove-Item "$env:LOCALAPPDATA\Microsoft\OneDrive" -Force -Recurse
  1268. }
  1269. If (Test-Path "$env:PROGRAMDATA\Microsoft OneDrive") {
  1270. Remove-Item "$env:PROGRAMDATA\Microsoft OneDrive" -Force -Recurse
  1271. }
  1272. If (Test-Path "$env:SYSTEMDRIVE\OneDriveTemp") {
  1273. Remove-Item "$env:SYSTEMDRIVE\OneDriveTemp" -Force -Recurse
  1274. }
  1275. Write-Host "Removing OneDrive from windows explorer"
  1276. If (!(Test-Path $ExplorerReg1)) {
  1277. New-Item $ExplorerReg1
  1278. }
  1279. Set-ItemProperty $ExplorerReg1 System.IsPinnedToNameSpaceTree -Value 0
  1280. If (!(Test-Path $ExplorerReg2)) {
  1281. New-Item $ExplorerReg2
  1282. }
  1283. Set-ItemProperty $ExplorerReg2 System.IsPinnedToNameSpaceTree -Value 0
  1284. Write-Host "Restarting Explorer that was shut down before."
  1285. Start-Process explorer.exe -NoNewWindow
  1286. Write-Host "OneDrive has been successfully uninstalled!"
  1287. Remove-item env:OneDrive
  1288. })
  1289. $InstallNet35.Add_Click( {
  1290. Write-Host "Initializing the installation of .NET 3.5..."
  1291. DISM /Online /Enable-Feature /FeatureName:NetFx3 /All
  1292. Write-Host ".NET 3.5 has been successfully installed!"
  1293. } )
  1294. $EnableDarkMode.Add_Click( {
  1295. Write-Host "Enabling Dark Mode"
  1296. $Theme = "HKCU:\SOFTWARE\Microsoft\Windows\CurrentVersion\Themes\Personalize"
  1297. Set-ItemProperty $Theme AppsUseLightTheme -Value 0
  1298. Start-Sleep 1
  1299. Write-Host "Enabled"
  1300. }
  1301. )
  1302. $DisableDarkMode.Add_Click( {
  1303. Write-Host "Disabling Dark Mode"
  1304. $Theme = "HKCU:\SOFTWARE\Microsoft\Windows\CurrentVersion\Themes\Personalize"
  1305. Set-ItemProperty $Theme AppsUseLightTheme -Value 1
  1306. Start-Sleep 1
  1307. Write-Host "Disabled"
  1308. }
  1309. )
  1310. [void]$Form.ShowDialog()