Windows10DebloaterGUIOLD.ps1 63 KB

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