Advertisement
marlonungos

Windows OS: Windows10Debloater

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