Windows10DebloaterGUIOLD.ps1 56 KB

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