Windows10DebloaterGUI.ps1 54 KB

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