Windows10DebloaterGUI.ps1 70 KB

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