Windows10DebloaterGUI.ps1 75 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487
  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(580,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 = 572
  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 = 560
  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. @($ListPanel.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. @($ListPanel.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(-10, (2 + $position * 25))
  509. $label.Text = $notes
  510. $label.Font = New-Object System.Drawing.Font('Consolas',8)
  511. $label.Width = 260
  512. $label.Height = 27
  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(268, (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 "Disabling Bing Search when using Search via the Start Menu"
  746. $BingSearch = 'HKCU:\SOFTWARE\Policies\Microsoft\Windows\Explorer'
  747. If (Test-Path $BingSearch) {
  748. Set-ItemProperty $BingSearch DisableSearchBoxSuggestions -Value 1
  749. }
  750. Write-Host "Removing CloudStore from registry if it exists"
  751. $CloudStore = 'HKCU:\Software\Microsoft\Windows\CurrentVersion\CloudStore'
  752. If (Test-Path $CloudStore) {
  753. Stop-Process Explorer.exe -Force
  754. Remove-Item $CloudStore -Recurse -Force
  755. Start-Process Explorer.exe -Wait
  756. }
  757. #Loads the registry keys/values below into the NTUSER.DAT file which prevents the apps from redownloading. Credit to a60wattfish
  758. reg load HKU\Default_User C:\Users\Default\NTUSER.DAT
  759. Set-ItemProperty -Path Registry::HKU\Default_User\SOFTWARE\Microsoft\Windows\CurrentVersion\ContentDeliveryManager -Name SystemPaneSuggestionsEnabled -Value 0
  760. Set-ItemProperty -Path Registry::HKU\Default_User\SOFTWARE\Microsoft\Windows\CurrentVersion\ContentDeliveryManager -Name PreInstalledAppsEnabled -Value 0
  761. Set-ItemProperty -Path Registry::HKU\Default_User\SOFTWARE\Microsoft\Windows\CurrentVersion\ContentDeliveryManager -Name OemPreInstalledAppsEnabled -Value 0
  762. reg unload HKU\Default_User
  763. #Disables scheduled tasks that are considered unnecessary
  764. Write-Host "Disabling scheduled tasks"
  765. #Get-ScheduledTask -TaskName XblGameSaveTaskLogon | Disable-ScheduledTask
  766. Get-ScheduledTask -TaskName XblGameSaveTask | Disable-ScheduledTask
  767. Get-ScheduledTask -TaskName Consolidator | Disable-ScheduledTask
  768. Get-ScheduledTask -TaskName UsbCeip | Disable-ScheduledTask
  769. Get-ScheduledTask -TaskName DmClient | Disable-ScheduledTask
  770. Get-ScheduledTask -TaskName DmClientOnScenarioDownload | Disable-ScheduledTask
  771. }
  772. Function UnpinStart {
  773. # https://superuser.com/a/1442733
  774. # Requires -RunAsAdministrator
  775. $START_MENU_LAYOUT = @"
  776. <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">
  777. <LayoutOptions StartTileGroupCellWidth="6" />
  778. <DefaultLayoutOverride>
  779. <StartLayoutCollection>
  780. <defaultlayout:StartLayout GroupCellWidth="6" />
  781. </StartLayoutCollection>
  782. </DefaultLayoutOverride>
  783. </LayoutModificationTemplate>
  784. "@
  785. $layoutFile="C:\Windows\StartMenuLayout.xml"
  786. #Delete layout file if it already exists
  787. If(Test-Path $layoutFile)
  788. {
  789. Remove-Item $layoutFile
  790. }
  791. #Creates the blank layout file
  792. $START_MENU_LAYOUT | Out-File $layoutFile -Encoding ASCII
  793. $regAliases = @("HKLM", "HKCU")
  794. #Assign the start layout and force it to apply with "LockedStartLayout" at both the machine and user level
  795. foreach ($regAlias in $regAliases){
  796. $basePath = $regAlias + ":\SOFTWARE\Policies\Microsoft\Windows"
  797. $keyPath = $basePath + "\Explorer"
  798. IF(!(Test-Path -Path $keyPath)) {
  799. New-Item -Path $basePath -Name "Explorer"
  800. }
  801. Set-ItemProperty -Path $keyPath -Name "LockedStartLayout" -Value 1
  802. Set-ItemProperty -Path $keyPath -Name "StartLayoutFile" -Value $layoutFile
  803. }
  804. #Restart Explorer, open the start menu (necessary to load the new layout), and give it a few seconds to process
  805. Stop-Process -name explorer
  806. Start-Sleep -s 5
  807. $wshell = New-Object -ComObject wscript.shell; $wshell.SendKeys('^{ESCAPE}')
  808. Start-Sleep -s 5
  809. #Enable the ability to pin items again by disabling "LockedStartLayout"
  810. foreach ($regAlias in $regAliases){
  811. $basePath = $regAlias + ":\SOFTWARE\Policies\Microsoft\Windows"
  812. $keyPath = $basePath + "\Explorer"
  813. Set-ItemProperty -Path $keyPath -Name "LockedStartLayout" -Value 0
  814. }
  815. #Restart Explorer and delete the layout file
  816. Stop-Process -name explorer
  817. # Uncomment the next line to make clean start menu default for all new users
  818. #Import-StartLayout -LayoutPath $layoutFile -MountPath $env:SystemDrive\
  819. Remove-Item $layoutFile
  820. }
  821. Function CheckInstallService {
  822. If (Get-Service InstallService | Where-Object { $_.Status -eq "Stopped" }) {
  823. Start-Service InstallService
  824. Set-Service InstallService -StartupType Automatic
  825. }
  826. }
  827. Write-Host "Initiating Sysprep"
  828. Begin-SysPrep
  829. Write-Host "Removing bloatware apps."
  830. DebloatAll
  831. Write-Host "Removing leftover bloatware registry keys."
  832. Remove-Keys
  833. Write-Host "Checking to see if any Allowlisted Apps were removed, and if so re-adding them."
  834. FixWhitelistedApps
  835. Write-Host "Stopping telemetry, disabling unneccessary scheduled tasks, and preventing bloatware from returning."
  836. Protect-Privacy
  837. Write-Host "Unpinning tiles from the Start Menu."
  838. UnpinStart
  839. Write-Host "Setting the 'InstallService' Windows service back to 'Started' and the Startup Type 'Automatic'."
  840. CheckDMWService
  841. CheckInstallService
  842. Write-Host "Finished all tasks. `n"
  843. } )
  844. $RevertChanges.Add_Click( {
  845. $ErrorActionPreference = 'SilentlyContinue'
  846. #This function will revert the changes you made when running the Start-Debloat function.
  847. #This line reinstalls all of the bloatware that was removed
  848. Get-AppxPackage -AllUsers | ForEach { Add-AppxPackage -Verbose -DisableDevelopmentMode -Register "$($_.InstallLocation)\AppXManifest.xml" }
  849. #Tells Windows to enable your advertising information.
  850. Write-Host "Re-enabling key to show advertisement information"
  851. $Advertising = "HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\AdvertisingInfo"
  852. If (Test-Path $Advertising) {
  853. Set-ItemProperty $Advertising Enabled -Value 1
  854. }
  855. #Enables Cortana to be used as part of your Windows Search Function
  856. Write-Host "Re-enabling Cortana to be used in your Windows Search"
  857. $Search = "HKLM:\SOFTWARE\Policies\Microsoft\Windows\Windows Search"
  858. If (Test-Path $Search) {
  859. Set-ItemProperty $Search AllowCortana -Value 1
  860. }
  861. #Re-enables the Windows Feedback Experience for sending anonymous data
  862. Write-Host "Re-enabling Windows Feedback Experience"
  863. $Period = "HKCU:\Software\Microsoft\Siuf\Rules"
  864. If (!(Test-Path $Period)) {
  865. New-Item $Period
  866. }
  867. Set-ItemProperty $Period PeriodInNanoSeconds -Value 1
  868. #Enables bloatware applications
  869. Write-Host "Adding Registry key to allow bloatware apps to return"
  870. $registryPath = "HKLM:\SOFTWARE\Policies\Microsoft\Windows\CloudContent"
  871. If (!(Test-Path $registryPath)) {
  872. New-Item $registryPath
  873. }
  874. Set-ItemProperty $registryPath DisableWindowsConsumerFeatures -Value 0
  875. #Changes Mixed Reality Portal Key 'FirstRunSucceeded' to 1
  876. Write-Host "Setting Mixed Reality Portal value to 1"
  877. $Holo = "HKCU:\Software\Microsoft\Windows\CurrentVersion\Holographic"
  878. If (Test-Path $Holo) {
  879. Set-ItemProperty $Holo FirstRunSucceeded -Value 1
  880. }
  881. #Re-enables live tiles
  882. Write-Host "Enabling live tiles"
  883. $Live = "HKCU:\SOFTWARE\Policies\Microsoft\Windows\CurrentVersion\PushNotifications"
  884. If (!(Test-Path $Live)) {
  885. New-Item $Live
  886. }
  887. Set-ItemProperty $Live NoTileApplicationNotification -Value 0
  888. #Re-enables data collection
  889. Write-Host "Re-enabling data collection"
  890. $DataCollection = "HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\Policies\DataCollection"
  891. If (!(Test-Path $DataCollection)) {
  892. New-Item $DataCollection
  893. }
  894. Set-ItemProperty $DataCollection AllowTelemetry -Value 1
  895. #Re-enables People Icon on Taskbar
  896. Write-Host "Enabling People Icon on Taskbar"
  897. $People = 'HKCU:\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\Advanced\People'
  898. If (Test-Path $People) {
  899. Set-ItemProperty $People -Name PeopleBand -Value 1 -Verbose
  900. }
  901. #Re-enables suggestions on start menu
  902. Write-Host "Enabling suggestions on the Start Menu"
  903. $Suggestions = "HKCU:\Software\Microsoft\Windows\CurrentVersion\ContentDeliveryManager"
  904. If (!(Test-Path $Suggestions)) {
  905. New-Item $Suggestions
  906. }
  907. Set-ItemProperty $Suggestions SystemPaneSuggestionsEnabled -Value 1
  908. #Re-enables scheduled tasks that were disabled when running the Debloat switch
  909. Write-Host "Enabling scheduled tasks that were disabled"
  910. Get-ScheduledTask XblGameSaveTaskLogon | Enable-ScheduledTask
  911. Get-ScheduledTask XblGameSaveTask | Enable-ScheduledTask
  912. Get-ScheduledTask Consolidator | Enable-ScheduledTask
  913. Get-ScheduledTask UsbCeip | Enable-ScheduledTask
  914. Get-ScheduledTask DmClient | Enable-ScheduledTask
  915. Get-ScheduledTask DmClientOnScenarioDownload | Enable-ScheduledTask
  916. Write-Host "Re-enabling and starting WAP Push Service"
  917. #Enable and start WAP Push Service
  918. Set-Service "dmwappushservice" -StartupType Automatic
  919. Start-Service "dmwappushservice"
  920. Write-Host "Re-enabling and starting the Diagnostics Tracking Service"
  921. #Enabling the Diagnostics Tracking Service
  922. Set-Service "DiagTrack" -StartupType Automatic
  923. Start-Service "DiagTrack"
  924. Write-Host "Done reverting changes!"
  925. #
  926. Write-Output "Restoring 3D Objects from Explorer 'My Computer' submenu"
  927. $Objects32 = "HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\MyComputer\NameSpace\{0DB7E03F-FC29-4DC6-9020-FF41B59E513A}"
  928. $Objects64 = "HKLM:\SOFTWARE\WOW6432Node\Microsoft\Windows\CurrentVersion\Explorer\MyComputer\NameSpace\{0DB7E03F-FC29-4DC6-9020-FF41B59E513A}"
  929. If (!(Test-Path $Objects32)) {
  930. New-Item $Objects32
  931. }
  932. If (!(Test-Path $Objects64)) {
  933. New-Item $Objects64
  934. }
  935. })
  936. $DisableCortana.Add_Click( {
  937. $ErrorActionPreference = 'SilentlyContinue'
  938. Write-Host "Disabling Cortana"
  939. $Cortana1 = "HKCU:\SOFTWARE\Microsoft\Personalization\Settings"
  940. $Cortana2 = "HKCU:\SOFTWARE\Microsoft\InputPersonalization"
  941. $Cortana3 = "HKCU:\SOFTWARE\Microsoft\InputPersonalization\TrainedDataStore"
  942. If (!(Test-Path $Cortana1)) {
  943. New-Item $Cortana1
  944. }
  945. Set-ItemProperty $Cortana1 AcceptedPrivacyPolicy -Value 0
  946. If (!(Test-Path $Cortana2)) {
  947. New-Item $Cortana2
  948. }
  949. Set-ItemProperty $Cortana2 RestrictImplicitTextCollection -Value 1
  950. Set-ItemProperty $Cortana2 RestrictImplicitInkCollection -Value 1
  951. If (!(Test-Path $Cortana3)) {
  952. New-Item $Cortana3
  953. }
  954. Set-ItemProperty $Cortana3 HarvestContacts -Value 0
  955. Write-Host "Cortana has been disabled."
  956. })
  957. $DisableEdgePDFTakeover.Add_Click( {
  958. $ErrorActionPreference = 'SilentlyContinue'
  959. #Stops edge from taking over as the default .PDF viewer
  960. Write-Host "Stopping Edge from taking over as the default .PDF viewer"
  961. $NoPDF = "HKCR:\.pdf"
  962. $NoProgids = "HKCR:\.pdf\OpenWithProgids"
  963. $NoWithList = "HKCR:\.pdf\OpenWithList"
  964. If (!(Get-ItemProperty $NoPDF NoOpenWith)) {
  965. New-ItemProperty $NoPDF NoOpenWith
  966. }
  967. If (!(Get-ItemProperty $NoPDF NoStaticDefaultVerb)) {
  968. New-ItemProperty $NoPDF NoStaticDefaultVerb
  969. }
  970. If (!(Get-ItemProperty $NoProgids NoOpenWith)) {
  971. New-ItemProperty $NoProgids NoOpenWith
  972. }
  973. If (!(Get-ItemProperty $NoProgids NoStaticDefaultVerb)) {
  974. New-ItemProperty $NoProgids NoStaticDefaultVerb
  975. }
  976. If (!(Get-ItemProperty $NoWithList NoOpenWith)) {
  977. New-ItemProperty $NoWithList NoOpenWith
  978. }
  979. If (!(Get-ItemProperty $NoWithList NoStaticDefaultVerb)) {
  980. New-ItemProperty $NoWithList NoStaticDefaultVerb
  981. }
  982. #Appends an underscore '_' to the Registry key for Edge
  983. $Edge = "HKCR:\AppXd4nrz8ff68srnhf9t5a8sbjyar1cr723_"
  984. If (Test-Path $Edge) {
  985. Set-Item $Edge AppXd4nrz8ff68srnhf9t5a8sbjyar1cr723_
  986. }
  987. Write-Host "Edge should no longer take over as the default .PDF."
  988. })
  989. $EnableCortana.Add_Click( {
  990. $ErrorActionPreference = 'SilentlyContinue'
  991. Write-Host "Re-enabling Cortana"
  992. $Cortana1 = "HKCU:\SOFTWARE\Microsoft\Personalization\Settings"
  993. $Cortana2 = "HKCU:\SOFTWARE\Microsoft\InputPersonalization"
  994. $Cortana3 = "HKCU:\SOFTWARE\Microsoft\InputPersonalization\TrainedDataStore"
  995. If (!(Test-Path $Cortana1)) {
  996. New-Item $Cortana1
  997. }
  998. Set-ItemProperty $Cortana1 AcceptedPrivacyPolicy -Value 1
  999. If (!(Test-Path $Cortana2)) {
  1000. New-Item $Cortana2
  1001. }
  1002. Set-ItemProperty $Cortana2 RestrictImplicitTextCollection -Value 0
  1003. Set-ItemProperty $Cortana2 RestrictImplicitInkCollection -Value 0
  1004. If (!(Test-Path $Cortana3)) {
  1005. New-Item $Cortana3
  1006. }
  1007. Set-ItemProperty $Cortana3 HarvestContacts -Value 1
  1008. Write-Host "Cortana has been enabled!"
  1009. })
  1010. $EnableEdgePDFTakeover.Add_Click( {
  1011. New-PSDrive HKCR -PSProvider Registry -Root HKEY_CLASSES_ROOT
  1012. $ErrorActionPreference = 'SilentlyContinue'
  1013. Write-Host "Setting Edge back to default"
  1014. $NoPDF = "HKCR:\.pdf"
  1015. $NoProgids = "HKCR:\.pdf\OpenWithProgids"
  1016. $NoWithList = "HKCR:\.pdf\OpenWithList"
  1017. #Sets edge back to default
  1018. If (Get-ItemProperty $NoPDF NoOpenWith) {
  1019. Remove-ItemProperty $NoPDF NoOpenWith
  1020. }
  1021. If (Get-ItemProperty $NoPDF NoStaticDefaultVerb) {
  1022. Remove-ItemProperty $NoPDF NoStaticDefaultVerb
  1023. }
  1024. If (Get-ItemProperty $NoProgids NoOpenWith) {
  1025. Remove-ItemProperty $NoProgids NoOpenWith
  1026. }
  1027. If (Get-ItemProperty $NoProgids NoStaticDefaultVerb) {
  1028. Remove-ItemProperty $NoProgids NoStaticDefaultVerb
  1029. }
  1030. If (Get-ItemProperty $NoWithList NoOpenWith) {
  1031. Remove-ItemProperty $NoWithList NoOpenWith
  1032. }
  1033. If (Get-ItemProperty $NoWithList NoStaticDefaultVerb) {
  1034. Remove-ItemProperty $NoWithList NoStaticDefaultVerb
  1035. }
  1036. #Removes an underscore '_' from the Registry key for Edge
  1037. $Edge2 = "HKCR:\AppXd4nrz8ff68srnhf9t5a8sbjyar1cr723_"
  1038. If (Test-Path $Edge2) {
  1039. Set-Item $Edge2 AppXd4nrz8ff68srnhf9t5a8sbjyar1cr723
  1040. }
  1041. Write-Host "Edge will now be able to be used for .PDF."
  1042. })
  1043. $DisableTelemetry.Add_Click( {
  1044. $ErrorActionPreference = 'SilentlyContinue'
  1045. #Disables Windows Feedback Experience
  1046. Write-Host "Disabling Windows Feedback Experience program"
  1047. $Advertising = "HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\AdvertisingInfo"
  1048. If (Test-Path $Advertising) {
  1049. Set-ItemProperty $Advertising Enabled -Value 0
  1050. }
  1051. #Stops Cortana from being used as part of your Windows Search Function
  1052. Write-Host "Stopping Cortana from being used as part of your Windows Search Function"
  1053. $Search = "HKLM:\SOFTWARE\Policies\Microsoft\Windows\Windows Search"
  1054. If (Test-Path $Search) {
  1055. Set-ItemProperty $Search AllowCortana -Value 0
  1056. }
  1057. #Disables Web Search in Start Menu
  1058. Write-Host "Disabling Bing Search in Start Menu"
  1059. $WebSearch = "HKLM:\SOFTWARE\Policies\Microsoft\Windows\Windows Search"
  1060. Set-ItemProperty "HKCU:\SOFTWARE\Microsoft\Windows\CurrentVersion\Search" BingSearchEnabled -Value 0
  1061. If (!(Test-Path $WebSearch)) {
  1062. New-Item $WebSearch
  1063. }
  1064. Set-ItemProperty $WebSearch DisableWebSearch -Value 1
  1065. #Stops the Windows Feedback Experience from sending anonymous data
  1066. Write-Host "Stopping the Windows Feedback Experience program"
  1067. $Period = "HKCU:\Software\Microsoft\Siuf\Rules"
  1068. If (!(Test-Path $Period)) {
  1069. New-Item $Period
  1070. }
  1071. Set-ItemProperty $Period PeriodInNanoSeconds -Value 0
  1072. #Prevents bloatware applications from returning and removes Start Menu suggestions
  1073. Write-Host "Adding Registry key to prevent bloatware apps from returning"
  1074. $registryPath = "HKLM:\SOFTWARE\Policies\Microsoft\Windows\CloudContent"
  1075. $registryOEM = "HKCU:\SOFTWARE\Microsoft\Windows\CurrentVersion\ContentDeliveryManager"
  1076. If (!(Test-Path $registryPath)) {
  1077. New-Item $registryPath
  1078. }
  1079. Set-ItemProperty $registryPath DisableWindowsConsumerFeatures -Value 1
  1080. If (!(Test-Path $registryOEM)) {
  1081. New-Item $registryOEM
  1082. }
  1083. Set-ItemProperty $registryOEM ContentDeliveryAllowed -Value 0
  1084. Set-ItemProperty $registryOEM OemPreInstalledAppsEnabled -Value 0
  1085. Set-ItemProperty $registryOEM PreInstalledAppsEnabled -Value 0
  1086. Set-ItemProperty $registryOEM PreInstalledAppsEverEnabled -Value 0
  1087. Set-ItemProperty $registryOEM SilentInstalledAppsEnabled -Value 0
  1088. Set-ItemProperty $registryOEM SystemPaneSuggestionsEnabled -Value 0
  1089. #Preping mixed Reality Portal for removal
  1090. Write-Host "Setting Mixed Reality Portal value to 0 so that you can uninstall it in Settings"
  1091. $Holo = "HKCU:\Software\Microsoft\Windows\CurrentVersion\Holographic"
  1092. If (Test-Path $Holo) {
  1093. Set-ItemProperty $Holo FirstRunSucceeded -Value 0
  1094. }
  1095. #Disables Wi-fi Sense
  1096. Write-Host "Disabling Wi-Fi Sense"
  1097. $WifiSense1 = "HKLM:\SOFTWARE\Microsoft\PolicyManager\default\WiFi\AllowWiFiHotSpotReporting"
  1098. $WifiSense2 = "HKLM:\SOFTWARE\Microsoft\PolicyManager\default\WiFi\AllowAutoConnectToWiFiSenseHotspots"
  1099. $WifiSense3 = "HKLM:\SOFTWARE\Microsoft\WcmSvc\wifinetworkmanager\config"
  1100. If (!(Test-Path $WifiSense1)) {
  1101. New-Item $WifiSense1
  1102. }
  1103. Set-ItemProperty $WifiSense1 Value -Value 0
  1104. If (!(Test-Path $WifiSense2)) {
  1105. New-Item $WifiSense2
  1106. }
  1107. Set-ItemProperty $WifiSense2 Value -Value 0
  1108. Set-ItemProperty $WifiSense3 AutoConnectAllowedOEM -Value 0
  1109. #Disables live tiles
  1110. Write-Host "Disabling live tiles"
  1111. $Live = "HKCU:\SOFTWARE\Policies\Microsoft\Windows\CurrentVersion\PushNotifications"
  1112. If (!(Test-Path $Live)) {
  1113. New-Item $Live
  1114. }
  1115. Set-ItemProperty $Live NoTileApplicationNotification -Value 1
  1116. #Turns off Data Collection via the AllowTelemtry key by changing it to 0
  1117. Write-Host "Turning off Data Collection"
  1118. $DataCollection1 = "HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\Policies\DataCollection"
  1119. $DataCollection2 = "HKLM:\SOFTWARE\Policies\Microsoft\Windows\DataCollection"
  1120. $DataCollection3 = "HKLM:\SOFTWARE\Wow6432Node\Microsoft\Windows\CurrentVersion\Policies\DataCollection"
  1121. If (Test-Path $DataCollection1) {
  1122. Set-ItemProperty $DataCollection1 AllowTelemetry -Value 0
  1123. }
  1124. If (Test-Path $DataCollection2) {
  1125. Set-ItemProperty $DataCollection2 AllowTelemetry -Value 0
  1126. }
  1127. If (Test-Path $DataCollection3) {
  1128. Set-ItemProperty $DataCollection3 AllowTelemetry -Value 0
  1129. }
  1130. #Disabling Location Tracking
  1131. Write-Host "Disabling Location Tracking"
  1132. $SensorState = "HKLM:\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Sensor\Overrides\{BFA794E4-F964-4FDB-90F6-51056BFE4B44}"
  1133. $LocationConfig = "HKLM:\SYSTEM\CurrentControlSet\Services\lfsvc\Service\Configuration"
  1134. If (!(Test-Path $SensorState)) {
  1135. New-Item $SensorState
  1136. }
  1137. Set-ItemProperty $SensorState SensorPermissionState -Value 0
  1138. If (!(Test-Path $LocationConfig)) {
  1139. New-Item $LocationConfig
  1140. }
  1141. Set-ItemProperty $LocationConfig Status -Value 0
  1142. #Disables People icon on Taskbar
  1143. Write-Host "Disabling People icon on Taskbar"
  1144. $People = 'HKCU:\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\Advanced\People'
  1145. If (Test-Path $People) {
  1146. Set-ItemProperty $People -Name PeopleBand -Value 0
  1147. }
  1148. #Disables scheduled tasks that are considered unnecessary
  1149. Write-Host "Disabling scheduled tasks"
  1150. #Get-ScheduledTask XblGameSaveTaskLogon | Disable-ScheduledTask
  1151. Get-ScheduledTask XblGameSaveTask | Disable-ScheduledTask
  1152. Get-ScheduledTask Consolidator | Disable-ScheduledTask
  1153. Get-ScheduledTask UsbCeip | Disable-ScheduledTask
  1154. Get-ScheduledTask DmClient | Disable-ScheduledTask
  1155. Get-ScheduledTask DmClientOnScenarioDownload | Disable-ScheduledTask
  1156. #Write-Host "Uninstalling Telemetry Windows Updates"
  1157. #Uninstalls Some Windows Updates considered to be Telemetry. !WIP!
  1158. #Wusa /Uninstall /KB:3022345 /norestart /quiet
  1159. #Wusa /Uninstall /KB:3068708 /norestart /quiet
  1160. #Wusa /Uninstall /KB:3075249 /norestart /quiet
  1161. #Wusa /Uninstall /KB:3080149 /norestart /quiet
  1162. Write-Host "Stopping and disabling WAP Push Service"
  1163. #Stop and disable WAP Push Service
  1164. Stop-Service "dmwappushservice"
  1165. Set-Service "dmwappushservice" -StartupType Disabled
  1166. Write-Host "Stopping and disabling Diagnostics Tracking Service"
  1167. #Disabling the Diagnostics Tracking Service
  1168. Stop-Service "DiagTrack"
  1169. Set-Service "DiagTrack" -StartupType Disabled
  1170. Write-Host "Telemetry has been disabled!"
  1171. })
  1172. $RemoveRegkeys.Add_Click( {
  1173. $ErrorActionPreference = 'SilentlyContinue'
  1174. $Keys = @(
  1175. New-PSDrive HKCR -PSProvider Registry -Root HKEY_CLASSES_ROOT
  1176. #Remove Background Tasks
  1177. "HKCR:\Extensions\ContractId\Windows.BackgroundTasks\PackageId\46928bounde.EclipseManager_2.2.4.51_neutral__a5h4egax66k6y"
  1178. "HKCR:\Extensions\ContractId\Windows.BackgroundTasks\PackageId\ActiproSoftwareLLC.562882FEEB491_2.6.18.18_neutral__24pqs290vpjk0"
  1179. "HKCR:\Extensions\ContractId\Windows.BackgroundTasks\PackageId\Microsoft.MicrosoftOfficeHub_17.7909.7600.0_x64__8wekyb3d8bbwe"
  1180. "HKCR:\Extensions\ContractId\Windows.BackgroundTasks\PackageId\Microsoft.PPIProjection_10.0.15063.0_neutral_neutral_cw5n1h2txyewy"
  1181. "HKCR:\Extensions\ContractId\Windows.BackgroundTasks\PackageId\Microsoft.XboxGameCallableUI_1000.15063.0.0_neutral_neutral_cw5n1h2txyewy"
  1182. "HKCR:\Extensions\ContractId\Windows.BackgroundTasks\PackageId\Microsoft.XboxGameCallableUI_1000.16299.15.0_neutral_neutral_cw5n1h2txyewy"
  1183. #Windows File
  1184. "HKCR:\Extensions\ContractId\Windows.File\PackageId\ActiproSoftwareLLC.562882FEEB491_2.6.18.18_neutral__24pqs290vpjk0"
  1185. #Registry keys to delete if they aren't uninstalled by RemoveAppXPackage/RemoveAppXProvisionedPackage
  1186. "HKCR:\Extensions\ContractId\Windows.Launch\PackageId\46928bounde.EclipseManager_2.2.4.51_neutral__a5h4egax66k6y"
  1187. "HKCR:\Extensions\ContractId\Windows.Launch\PackageId\ActiproSoftwareLLC.562882FEEB491_2.6.18.18_neutral__24pqs290vpjk0"
  1188. "HKCR:\Extensions\ContractId\Windows.Launch\PackageId\Microsoft.PPIProjection_10.0.15063.0_neutral_neutral_cw5n1h2txyewy"
  1189. "HKCR:\Extensions\ContractId\Windows.Launch\PackageId\Microsoft.XboxGameCallableUI_1000.15063.0.0_neutral_neutral_cw5n1h2txyewy"
  1190. "HKCR:\Extensions\ContractId\Windows.Launch\PackageId\Microsoft.XboxGameCallableUI_1000.16299.15.0_neutral_neutral_cw5n1h2txyewy"
  1191. #Scheduled Tasks to delete
  1192. "HKCR:\Extensions\ContractId\Windows.PreInstalledConfigTask\PackageId\Microsoft.MicrosoftOfficeHub_17.7909.7600.0_x64__8wekyb3d8bbwe"
  1193. #Windows Protocol Keys
  1194. "HKCR:\Extensions\ContractId\Windows.Protocol\PackageId\ActiproSoftwareLLC.562882FEEB491_2.6.18.18_neutral__24pqs290vpjk0"
  1195. "HKCR:\Extensions\ContractId\Windows.Protocol\PackageId\Microsoft.PPIProjection_10.0.15063.0_neutral_neutral_cw5n1h2txyewy"
  1196. "HKCR:\Extensions\ContractId\Windows.Protocol\PackageId\Microsoft.XboxGameCallableUI_1000.15063.0.0_neutral_neutral_cw5n1h2txyewy"
  1197. "HKCR:\Extensions\ContractId\Windows.Protocol\PackageId\Microsoft.XboxGameCallableUI_1000.16299.15.0_neutral_neutral_cw5n1h2txyewy"
  1198. #Windows Share Target
  1199. "HKCR:\Extensions\ContractId\Windows.ShareTarget\PackageId\ActiproSoftwareLLC.562882FEEB491_2.6.18.18_neutral__24pqs290vpjk0"
  1200. )
  1201. #This writes the output of each key it is removing and also removes the keys listed above.
  1202. ForEach ($Key in $Keys) {
  1203. Write-Host "Removing $Key from registry"
  1204. Remove-Item $Key -Recurse
  1205. }
  1206. Write-Host "Additional bloatware keys have been removed!"
  1207. })
  1208. $UnpinStartMenuTiles.Add_Click( {
  1209. #https://superuser.com/questions/1068382/how-to-remove-all-the-tiles-in-the-windows-10-start-menu
  1210. #Unpins all tiles from the Start Menu
  1211. Write-Host "Unpinning all tiles from the start menu"
  1212. (New-Object -Com Shell.Application).
  1213. NameSpace('shell:::{4234d49b-0245-4df3-b780-3893943456e1}').
  1214. Items() |
  1215. % { $_.Verbs() } |
  1216. ? { $_.Name -match 'Un.*pin from Start' } |
  1217. % { $_.DoIt() }
  1218. })
  1219. $RemoveOnedrive.Add_Click( {
  1220. If (Test-Path "$env:USERPROFILE\OneDrive\*") {
  1221. Write-Host "Files found within the OneDrive folder! Checking to see if a folder named OneDriveBackupFiles exists."
  1222. Start-Sleep 1
  1223. If (Test-Path "$env:USERPROFILE\Desktop\OneDriveBackupFiles") {
  1224. Write-Host "A folder named OneDriveBackupFiles already exists on your desktop. All files from your OneDrive location will be moved to that folder."
  1225. }
  1226. else {
  1227. If (!(Test-Path "$env:USERPROFILE\Desktop\OneDriveBackupFiles")) {
  1228. 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."
  1229. New-item -Path "$env:USERPROFILE\Desktop" -Name "OneDriveBackupFiles"-ItemType Directory -Force
  1230. Write-Host "Successfully created the folder 'OneDriveBackupFiles' on your desktop."
  1231. }
  1232. }
  1233. Start-Sleep 1
  1234. Move-Item -Path "$env:USERPROFILE\OneDrive\*" -Destination "$env:USERPROFILE\Desktop\OneDriveBackupFiles" -Force
  1235. Write-Host "Successfully moved all files/folders from your OneDrive folder to the folder 'OneDriveBackupFiles' on your desktop."
  1236. Start-Sleep 1
  1237. Write-Host "Proceeding with the removal of OneDrive."
  1238. Start-Sleep 1
  1239. }
  1240. Else {
  1241. 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."
  1242. Start-Sleep 1
  1243. Write-Host "Enabling the Group Policy 'Prevent the usage of OneDrive for File Storage'."
  1244. $OneDriveKey = 'HKLM:Software\Policies\Microsoft\Windows\OneDrive'
  1245. If (!(Test-Path $OneDriveKey)) {
  1246. Mkdir $OneDriveKey
  1247. Set-ItemProperty $OneDriveKey -Name OneDrive -Value DisableFileSyncNGSC
  1248. }
  1249. Set-ItemProperty $OneDriveKey -Name OneDrive -Value DisableFileSyncNGSC
  1250. }
  1251. Write-Host "Uninstalling OneDrive. Please wait..."
  1252. New-PSDrive HKCR -PSProvider Registry -Root HKEY_CLASSES_ROOT
  1253. $onedrive = "$env:SYSTEMROOT\SysWOW64\OneDriveSetup.exe"
  1254. $ExplorerReg1 = "HKCR:\CLSID\{018D5C66-4533-4307-9B53-224DE2ED1FE6}"
  1255. $ExplorerReg2 = "HKCR:\Wow6432Node\CLSID\{018D5C66-4533-4307-9B53-224DE2ED1FE6}"
  1256. Stop-Process -Name "OneDrive*"
  1257. Start-Sleep 2
  1258. If (!(Test-Path $onedrive)) {
  1259. $onedrive = "$env:SYSTEMROOT\System32\OneDriveSetup.exe"
  1260. }
  1261. Start-Process $onedrive "/uninstall" -NoNewWindow -Wait
  1262. Start-Sleep 2
  1263. Write-Host "Stopping explorer"
  1264. Start-Sleep 1
  1265. taskkill.exe /F /IM explorer.exe
  1266. Start-Sleep 3
  1267. Write-Host "Removing leftover files"
  1268. If (Test-Path "$env:USERPROFILE\OneDrive") {
  1269. Remove-Item "$env:USERPROFILE\OneDrive" -Force -Recurse
  1270. }
  1271. If (Test-Path "$env:LOCALAPPDATA\Microsoft\OneDrive") {
  1272. Remove-Item "$env:LOCALAPPDATA\Microsoft\OneDrive" -Force -Recurse
  1273. }
  1274. If (Test-Path "$env:PROGRAMDATA\Microsoft OneDrive") {
  1275. Remove-Item "$env:PROGRAMDATA\Microsoft OneDrive" -Force -Recurse
  1276. }
  1277. If (Test-Path "$env:SYSTEMDRIVE\OneDriveTemp") {
  1278. Remove-Item "$env:SYSTEMDRIVE\OneDriveTemp" -Force -Recurse
  1279. }
  1280. Write-Host "Removing OneDrive from windows explorer"
  1281. If (!(Test-Path $ExplorerReg1)) {
  1282. New-Item $ExplorerReg1
  1283. }
  1284. Set-ItemProperty $ExplorerReg1 System.IsPinnedToNameSpaceTree -Value 0
  1285. If (!(Test-Path $ExplorerReg2)) {
  1286. New-Item $ExplorerReg2
  1287. }
  1288. Set-ItemProperty $ExplorerReg2 System.IsPinnedToNameSpaceTree -Value 0
  1289. Write-Host "Restarting Explorer that was shut down before."
  1290. Start-Process explorer.exe -NoNewWindow
  1291. Write-Host "OneDrive has been successfully uninstalled!"
  1292. Remove-item env:OneDrive
  1293. })
  1294. $InstallNet35.Add_Click( {
  1295. Write-Host "Initializing the installation of .NET 3.5..."
  1296. DISM /Online /Enable-Feature /FeatureName:NetFx3 /All
  1297. Write-Host ".NET 3.5 has been successfully installed!"
  1298. } )
  1299. $EnableDarkMode.Add_Click( {
  1300. Write-Host "Enabling Dark Mode"
  1301. $Theme = "HKCU:\SOFTWARE\Microsoft\Windows\CurrentVersion\Themes\Personalize"
  1302. Set-ItemProperty $Theme AppsUseLightTheme -Value 0
  1303. Start-Sleep 1
  1304. Write-Host "Enabled"
  1305. }
  1306. )
  1307. $DisableDarkMode.Add_Click( {
  1308. Write-Host "Disabling Dark Mode"
  1309. $Theme = "HKCU:\SOFTWARE\Microsoft\Windows\CurrentVersion\Themes\Personalize"
  1310. Set-ItemProperty $Theme AppsUseLightTheme -Value 1
  1311. Start-Sleep 1
  1312. Write-Host "Disabled"
  1313. }
  1314. )
  1315. [void]$Form.ShowDialog()