Windows10DebloaterGUIOLD.ps1 64 KB

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