Windows10DebloaterGUI.ps1 64 KB

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