Windows10DebloaterGUI.ps1 72 KB

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