Windows10DebloaterGUIOLD.ps1 64 KB

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