From 26dbca566f28979c78529db6f9b2981f8bb52f5b Mon Sep 17 00:00:00 2001 From: Richard Newton Date: Tue, 16 Oct 2018 22:04:12 -0700 Subject: [PATCH 01/15] Created Windows10DebloaterGUI This is my test file that I have been working with. I am currently creating a GUI for all of the code in this Repository and am working to make it function appropriately. It isn't completely functioning as intended, so before you use it on machines you care about, please make sure you understand that this is in development and I cannot guarantee that things won't break. Also make sure to make a backup. --- Windows10DebloaterGUI | 1150 +++++++++++++++++++++++++++++++++++++++++ 1 file changed, 1150 insertions(+) create mode 100644 Windows10DebloaterGUI diff --git a/Windows10DebloaterGUI b/Windows10DebloaterGUI new file mode 100644 index 00000000..c1efff3c --- /dev/null +++ b/Windows10DebloaterGUI @@ -0,0 +1,1150 @@ +<# This form was created using POSHGUI.com a free online gui designer for PowerShell +.NAME + Untitled +#> + +Add-Type -AssemblyName System.Windows.Forms +[System.Windows.Forms.Application]::EnableVisualStyles() + +#region begin GUI{ + +$Form = New-Object system.Windows.Forms.Form +$Form.ClientSize = '408,523' +$Form.text = "Windows10Debloater" +$Form.TopMost = $false + +$Debloat = New-Object system.Windows.Forms.Label +$Debloat.text = "Debloat Options" +$Debloat.AutoSize = $true +$Debloat.width = 25 +$Debloat.height = 10 +$Debloat.location = New-Object System.Drawing.Point(9, 8) +$Debloat.Font = 'Microsoft Sans Serif,12,style=Bold,Underline' + +$RemoveDebloat = New-Object system.Windows.Forms.Button +$RemoveDebloat.text = "Remove All Bloatware" +$RemoveDebloat.width = 142 +$RemoveDebloat.height = 40 +$RemoveDebloat.location = New-Object System.Drawing.Point(8, 32) +$RemoveDebloat.Font = 'Microsoft Sans Serif,10' + +$RemoveBlacklist = New-Object system.Windows.Forms.Button +$RemoveBlacklist.text = "Remove Bloatware With Blacklist" +$RemoveBlacklist.width = 205 +$RemoveBlacklist.height = 37 +$RemoveBlacklist.location = New-Object System.Drawing.Point(9, 79) +$RemoveBlacklist.Font = 'Microsoft Sans Serif,10' + +$Label1 = New-Object system.Windows.Forms.Label +$Label1.text = "Revert Debloat " +$Label1.AutoSize = $true +$Label1.width = 25 +$Label1.height = 10 +$Label1.location = New-Object System.Drawing.Point(254, 7) +$Label1.Font = 'Microsoft Sans Serif,12,style=Bold,Underline' + +$RevertChange = New-Object system.Windows.Forms.Button +$RevertChange.text = "Revert Changes" +$RevertChange.width = 113 +$RevertChange.height = 36 +$RevertChange.location = New-Object System.Drawing.Point(254, 32) +$RevertChange.Font = 'Microsoft Sans Serif,10' + +$Label2 = New-Object system.Windows.Forms.Label +$Label2.text = "Optional Privacy Changes/Fixes" +$Label2.AutoSize = $true +$Label2.width = 25 +$Label2.height = 10 +$Label2.location = New-Object System.Drawing.Point(9, 193) +$Label2.Font = 'Microsoft Sans Serif,12,style=Bold,Underline' + +$DisableCortana = New-Object system.Windows.Forms.Button +$DisableCortana.text = "Disable Cortana" +$DisableCortana.width = 111 +$DisableCortana.height = 36 +$DisableCortana.location = New-Object System.Drawing.Point(9, 217) +$DisableCortana.Font = 'Microsoft Sans Serif,10' + +$EnableCortana = New-Object system.Windows.Forms.Button +$EnableCortana.text = "Enable Cortana" +$EnableCortana.width = 112 +$EnableCortana.height = 36 +$EnableCortana.location = New-Object System.Drawing.Point(9, 260) +$EnableCortana.Font = 'Microsoft Sans Serif,10' + +$StopEdgePDFTakeover = New-Object system.Windows.Forms.Button +$StopEdgePDFTakeover.text = "Stop Edge PDF Takeover" +$StopEdgePDFTakeover.width = 161 +$StopEdgePDFTakeover.height = 38 +$StopEdgePDFTakeover.location = New-Object System.Drawing.Point(130, 217) +$StopEdgePDFTakeover.Font = 'Microsoft Sans Serif,10' + +$EnableEdgePDFTakeover = New-Object system.Windows.Forms.Button +$EnableEdgePDFTakeover.text = "Enable Edge PDF Takeover" +$EnableEdgePDFTakeover.width = 177 +$EnableEdgePDFTakeover.height = 39 +$EnableEdgePDFTakeover.location = New-Object System.Drawing.Point(130, 260) +$EnableEdgePDFTakeover.Font = 'Microsoft Sans Serif,10' + +$DisableTelemetry = New-Object system.Windows.Forms.Button +$DisableTelemetry.text = "Disable Telemetry/Tasks" +$DisableTelemetry.width = 152 +$DisableTelemetry.height = 35 +$DisableTelemetry.location = New-Object System.Drawing.Point(9, 303) +$DisableTelemetry.Font = 'Microsoft Sans Serif,10' + +$RemoveRegkeys = New-Object system.Windows.Forms.Button +$RemoveRegkeys.text = "Remove Bloatware Regkeys" +$RemoveRegkeys.width = 177 +$RemoveRegkeys.height = 40 +$RemoveRegkeys.location = New-Object System.Drawing.Point(169, 303) +$RemoveRegkeys.Font = 'Microsoft Sans Serif,10' + +$RemoveOnedrive = New-Object system.Windows.Forms.Button +$RemoveOnedrive.text = "Uninstall OneDrive" +$RemoveOnedrive.width = 117 +$RemoveOnedrive.height = 35 +$RemoveOnedrive.location = New-Object System.Drawing.Point(9, 345) +$RemoveOnedrive.Font = 'Microsoft Sans Serif,10' + +$FixWhitelist = New-Object system.Windows.Forms.Button +$FixWhitelist.text = "Fix Whitelisted Apps" +$FixWhitelist.width = 130 +$FixWhitelist.height = 37 +$FixWhitelist.location = New-Object System.Drawing.Point(254, 74) +$FixWhitelist.Font = 'Microsoft Sans Serif,10' + +$RemoveBloatNoBlacklist = New-Object system.Windows.Forms.Button +$RemoveBloatNoBlacklist.text = "Remove Bloatware Without Blacklist" +$RemoveBloatNoBlacklist.width = 223 +$RemoveBloatNoBlacklist.height = 39 +$RemoveBloatNoBlacklist.location = New-Object System.Drawing.Point(9, 123) +$RemoveBloatNoBlacklist.Font = 'Microsoft Sans Serif,10' + +$Form.controls.AddRange(@($Debloat, $RemoveDebloat, $RemoveBlacklist, $Label1, $RevertChange, $Label2, $DisableCortana, $EnableCortana, $StopEdgePDFTakeover, $EnableEdgePDFTakeover, $DisableTelemetry, $RemoveRegkeys, $RemoveOnedrive, $FixWhitelist, $RemoveBloatNoBlacklist)) + +#region gui events { +$RemoveDebloat.Add_Click( { + $ErrorActionPreference = 'silentlycontinue' + Function DebloatBlacklist { + [CmdletBinding()] + + Param () + + $Bloatware = @( + + #Unnecessary Windows 10 AppX Apps + "Microsoft.BingNews" + "Microsoft.DesktopAppInstaller" + "Microsoft.GetHelp" + "Microsoft.Getstarted" + "Microsoft.Messaging" + "Microsoft.Microsoft3DViewer" + "Microsoft.MicrosoftOfficeHub" + "Microsoft.MicrosoftSolitaireCollection" + "Microsoft.NetworkSpeedTest" + "Microsoft.Office.OneNote" + "Microsoft.Office.Sway" + "Microsoft.OneConnect" + "Microsoft.People" + "Microsoft.Print3D" + "Microsoft.RemoteDesktop" + "Microsoft.SkypeApp" + "Microsoft.StorePurchaseApp" + "Microsoft.WindowsAlarms" + "Microsoft.WindowsCamera" + "microsoft.windowscommunicationsapps" + "Microsoft.WindowsFeedbackHub" + "Microsoft.WindowsMaps" + "Microsoft.WindowsSoundRecorder" + "Microsoft.Xbox.TCUI" + "Microsoft.XboxApp" + "Microsoft.XboxGameOverlay" + "Microsoft.XboxIdentityProvider" + "Microsoft.XboxSpeechToTextOverlay" + "Microsoft.ZuneMusic" + "Microsoft.ZuneVideo" + + #Sponsored Windows 10 AppX Apps + #Add sponsored/featured apps to remove in the "*AppName*" format + "*EclipseManager*" + "*ActiproSoftwareLLC*" + "*AdobeSystemsIncorporated.AdobePhotoshopExpress*" + "*Duolingo-LearnLanguagesforFree*" + "*PandoraMediaInc*" + "*CandyCrush*" + "*Wunderlist*" + "*Flipboard*" + "*Twitter*" + "*Facebook*" + "*Spotify*" + "*Minecraft*" + "*Royal Revolt*" + + #Optional: Typically not removed but you can if you need to for some reason + #"*Microsoft.Advertising.Xaml_10.1712.5.0_x64__8wekyb3d8bbwe*" + #"*Microsoft.Advertising.Xaml_10.1712.5.0_x86__8wekyb3d8bbwe*" + #"*Microsoft.BingWeather*" + #"*Microsoft.MSPaint*" + #"*Microsoft.MicrosoftStickyNotes*" + #"*Microsoft.Windows.Photos*" + #"*Microsoft.WindowsCalculator*" + #"*Microsoft.WindowsStore*" + ) + foreach ($Bloat in $Bloatware) { + Get-AppxPackage -Name $Bloat| Remove-AppxPackage -ErrorAction SilentlyContinue + Get-AppxProvisionedPackage -Online | Where-Object DisplayName -like $Debloat | Remove-AppxProvisionedPackage -Online -ErrorAction SilentlyContinue + Write-Output "Trying to remove $Bloat." + } + } + }) +$RemoveBlacklist.Add_Click( { + #This function finds any AppX/AppXProvisioned package and uninstalls it, except for Freshpaint, Windows Calculator, Windows Store, and Windows Photos. + #Also, to note - This does NOT remove essential system services/software/etc such as .NET framework installations, Cortana, Edge, etc. + + #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. + + Function Begin-SysPrep { + + Write-Verbose -Message ('Starting Sysprep Fixes') + + # Disable Windows Store Automatic Updates + Write-Verbose -Message "Adding Registry key to Disable Windows Store Automatic Updates" + $registryPath = "HKLM:\SOFTWARE\Policies\Microsoft\WindowsStore" + If (!(Test-Path $registryPath)) { + Mkdir $registryPath -ErrorAction SilentlyContinue + New-ItemProperty $registryPath -Name AutoDownload -Value 2 + } + Else { + Set-ItemProperty $registryPath -Name AutoDownload -Value 2 + } + #Stop WindowsStore Installer Service and set to Disabled + Write-Verbose -Message ('Stopping InstallService') + Stop-Service InstallService + Write-Verbose -Message ('Setting InstallService Startup to Disabled') + & Set-Service -Name InstallService -StartupType Disabled + } + + Function DebloatAll { + + [CmdletBinding()] + + Param() + + #Removes AppxPackages + #Credit to /u/GavinEke for a modified version of my whitelist code + [regex]$WhitelistedApps = 'Microsoft.ScreenSketch|Microsoft.ScreenSketch|Microsoft.Paint3D|Microsoft.WindowsCalculator|Microsoft.WindowsStore|Microsoft.Windows.Photos|CanonicalGroupLimited.UbuntuonWindows|Microsoft.XboxGameCallableUI|Microsoft.XboxGamingOverlay|Microsoft.Xbox.TCUI|Microsoft.XboxGamingOverlay|Microsoft.XboxIdentityProvider|Microsoft.MicrosoftStickyNotes|Microsoft.MSPaint' + Get-AppxPackage -AllUsers | Where-Object {$_.Name -NotMatch $WhitelistedApps} | Remove-AppxPackage + Get-AppxPackage | Where-Object {$_.Name -NotMatch $WhitelistedApps} | Remove-AppxPackage + Get-AppxProvisionedPackage -Online | Where-Object {$_.PackageName -NotMatch $WhitelistedApps} | Remove-AppxProvisionedPackage -Online + } + + #Creates a PSDrive to be able to access the 'HKCR' tree + New-PSDrive -Name HKCR -PSProvider Registry -Root HKEY_CLASSES_ROOT + Function DebloatBlacklist { + + $Bloatware = @( + + #Unnecessary Windows 10 AppX Apps + "Microsoft.BingNews" + "Microsoft.DesktopAppInstaller" + "Microsoft.GetHelp" + "Microsoft.Getstarted" + "Microsoft.Messaging" + "Microsoft.Microsoft3DViewer" + "Microsoft.MicrosoftOfficeHub" + "Microsoft.MicrosoftSolitaireCollection" + "Microsoft.NetworkSpeedTest" + "Microsoft.Office.OneNote" + "Microsoft.Office.Sway" + "Microsoft.OneConnect" + "Microsoft.People" + "Microsoft.Print3D" + "Microsoft.RemoteDesktop" + "Microsoft.SkypeApp" + "Microsoft.StorePurchaseApp" + "Microsoft.WindowsAlarms" + "Microsoft.WindowsCamera" + "microsoft.windowscommunicationsapps" + "Microsoft.WindowsFeedbackHub" + "Microsoft.WindowsMaps" + "Microsoft.WindowsSoundRecorder" + "Microsoft.Xbox.TCUI" + "Microsoft.XboxApp" + "Microsoft.XboxGameOverlay" + "Microsoft.XboxIdentityProvider" + "Microsoft.XboxSpeechToTextOverlay" + "Microsoft.ZuneMusic" + "Microsoft.ZuneVideo" + + #Sponsored Windows 10 AppX Apps + #Add sponsored/featured apps to remove in the "*AppName*" format + "*EclipseManager*" + "*ActiproSoftwareLLC*" + "*AdobeSystemsIncorporated.AdobePhotoshopExpress*" + "*Duolingo-LearnLanguagesforFree*" + "*PandoraMediaInc*" + "*CandyCrush*" + "*Wunderlist*" + "*Flipboard*" + "*Twitter*" + "*Facebook*" + "*Spotify*" + "*Minecraft*" + "*Royal Revolt*" + + #Optional: Typically not removed but you can if you need to for some reason + #"*Microsoft.Advertising.Xaml_10.1712.5.0_x64__8wekyb3d8bbwe*" + #"*Microsoft.Advertising.Xaml_10.1712.5.0_x86__8wekyb3d8bbwe*" + #"*Microsoft.BingWeather*" + #"*Microsoft.MSPaint*" + #"*Microsoft.MicrosoftStickyNotes*" + #"*Microsoft.Windows.Photos*" + #"*Microsoft.WindowsCalculator*" + #"*Microsoft.WindowsStore*" + ) + foreach ($Bloat in $Bloatware) { + Get-AppxPackage -Name $Bloat| Remove-AppxPackage -ErrorAction SilentlyContinue + Get-AppxProvisionedPackage -Online | Where-Object DisplayName -like $Debloat | Remove-AppxProvisionedPackage -Online -ErrorAction SilentlyContinue + Write-Output "Trying to remove $Bloat." + } + } + + Function Remove-Keys { + + #These are the registry keys that it will delete. + + $Keys = @( + + #Remove Background Tasks + "HKCR:\Extensions\ContractId\Windows.BackgroundTasks\PackageId\46928bounde.EclipseManager_2.2.4.51_neutral__a5h4egax66k6y" + "HKCR:\Extensions\ContractId\Windows.BackgroundTasks\PackageId\ActiproSoftwareLLC.562882FEEB491_2.6.18.18_neutral__24pqs290vpjk0" + "HKCR:\Extensions\ContractId\Windows.BackgroundTasks\PackageId\Microsoft.MicrosoftOfficeHub_17.7909.7600.0_x64__8wekyb3d8bbwe" + "HKCR:\Extensions\ContractId\Windows.BackgroundTasks\PackageId\Microsoft.PPIProjection_10.0.15063.0_neutral_neutral_cw5n1h2txyewy" + "HKCR:\Extensions\ContractId\Windows.BackgroundTasks\PackageId\Microsoft.XboxGameCallableUI_1000.15063.0.0_neutral_neutral_cw5n1h2txyewy" + "HKCR:\Extensions\ContractId\Windows.BackgroundTasks\PackageId\Microsoft.XboxGameCallableUI_1000.16299.15.0_neutral_neutral_cw5n1h2txyewy" + + #Windows File + "HKCR:\Extensions\ContractId\Windows.File\PackageId\ActiproSoftwareLLC.562882FEEB491_2.6.18.18_neutral__24pqs290vpjk0" + + #Registry keys to delete if they aren't uninstalled by RemoveAppXPackage/RemoveAppXProvisionedPackage + "HKCR:\Extensions\ContractId\Windows.Launch\PackageId\46928bounde.EclipseManager_2.2.4.51_neutral__a5h4egax66k6y" + "HKCR:\Extensions\ContractId\Windows.Launch\PackageId\ActiproSoftwareLLC.562882FEEB491_2.6.18.18_neutral__24pqs290vpjk0" + "HKCR:\Extensions\ContractId\Windows.Launch\PackageId\Microsoft.PPIProjection_10.0.15063.0_neutral_neutral_cw5n1h2txyewy" + "HKCR:\Extensions\ContractId\Windows.Launch\PackageId\Microsoft.XboxGameCallableUI_1000.15063.0.0_neutral_neutral_cw5n1h2txyewy" + "HKCR:\Extensions\ContractId\Windows.Launch\PackageId\Microsoft.XboxGameCallableUI_1000.16299.15.0_neutral_neutral_cw5n1h2txyewy" + + #Scheduled Tasks to delete + "HKCR:\Extensions\ContractId\Windows.PreInstalledConfigTask\PackageId\Microsoft.MicrosoftOfficeHub_17.7909.7600.0_x64__8wekyb3d8bbwe" + + #Windows Protocol Keys + "HKCR:\Extensions\ContractId\Windows.Protocol\PackageId\ActiproSoftwareLLC.562882FEEB491_2.6.18.18_neutral__24pqs290vpjk0" + "HKCR:\Extensions\ContractId\Windows.Protocol\PackageId\Microsoft.PPIProjection_10.0.15063.0_neutral_neutral_cw5n1h2txyewy" + "HKCR:\Extensions\ContractId\Windows.Protocol\PackageId\Microsoft.XboxGameCallableUI_1000.15063.0.0_neutral_neutral_cw5n1h2txyewy" + "HKCR:\Extensions\ContractId\Windows.Protocol\PackageId\Microsoft.XboxGameCallableUI_1000.16299.15.0_neutral_neutral_cw5n1h2txyewy" + + #Windows Share Target + "HKCR:\Extensions\ContractId\Windows.ShareTarget\PackageId\ActiproSoftwareLLC.562882FEEB491_2.6.18.18_neutral__24pqs290vpjk0" + ) + + #This writes the output of each key it is removing and also removes the keys listed above. + ForEach ($Key in $Keys) { + Write-Output "Removing $Key from registry" + Remove-Item $Key -Recurse -ErrorAction SilentlyContinue + } + } + + Function Protect-Privacy { + + #Creates a PSDrive to be able to access the 'HKCR' tree + New-PSDrive -Name HKCR -PSProvider Registry -Root HKEY_CLASSES_ROOT + + #Disables Windows Feedback Experience + Write-Output "Disabling Windows Feedback Experience program" + $Advertising = 'HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\AdvertisingInfo' + If (Test-Path $Advertising) { + Set-ItemProperty $Advertising -Name Enabled -Value 0 -Verbose + } + + #Stops Cortana from being used as part of your Windows Search Function + Write-Output "Stopping Cortana from being used as part of your Windows Search Function" + $Search = 'HKLM:\SOFTWARE\Policies\Microsoft\Windows\Windows Search' + If (Test-Path $Search) { + Set-ItemProperty $Search -Name AllowCortana -Value 0 -Verbose + } + + #Stops the Windows Feedback Experience from sending anonymous data + Write-Output "Stopping the Windows Feedback Experience program" + $Period1 = 'HKCU:\Software\Microsoft\Siuf' + $Period2 = 'HKCU:\Software\Microsoft\Siuf\Rules' + $Period3 = 'HKCU:\Software\Microsoft\Siuf\Rules\PeriodInNanoSeconds' + If (!(Test-Path $Period3)) { + mkdir $Period1 -ErrorAction SilentlyContinue + mkdir $Period2 -ErrorAction SilentlyContinue + mkdir $Period3 -ErrorAction SilentlyContinue + New-ItemProperty $Period3 -Name PeriodInNanoSeconds -Value 0 -Verbose -ErrorAction SilentlyContinue + } + + Write-Output "Adding Registry key to prevent bloatware apps from returning" + #Prevents bloatware applications from returning + $registryPath = "HKLM:\SOFTWARE\Policies\Microsoft\Windows\CloudContent" + If (!(Test-Path $registryPath)) { + Mkdir $registryPath -ErrorAction SilentlyContinue + New-ItemProperty $registryPath -Name DisableWindowsConsumerFeatures -Value 1 -Verbose -ErrorAction SilentlyContinue + } + + Write-Output "Setting Mixed Reality Portal value to 0 so that you can uninstall it in Settings" + $Holo = 'HKCU:\Software\Microsoft\Windows\CurrentVersion\Holographic' + If (Test-Path $Holo) { + Set-ItemProperty $Holo -Name FirstRunSucceeded -Value 0 -Verbose + } + + #Disables live tiles + Write-Output "Disabling live tiles" + $Live = 'HKCU:\SOFTWARE\Policies\Microsoft\Windows\CurrentVersion\PushNotifications' + If (!(Test-Path $Live)) { + mkdir $Live -ErrorAction SilentlyContinue + New-ItemProperty $Live -Name NoTileApplicationNotification -Value 1 -Verbose + } + + #Turns off Data Collection via the AllowTelemtry key by changing it to 0 + Write-Output "Turning off Data Collection" + $DataCollection = 'HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\Policies\DataCollection' + If (Test-Path $DataCollection) { + Set-ItemProperty $DataCollection -Name AllowTelemetry -Value 0 -Verbose + } + + #Disables People icon on Taskbar + Write-Output "Disabling People icon on Taskbar" + $People = 'HKCU:\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\Advanced\People' + If (!(Test-Path $People)) { + mkdir $People -ErrorAction SilentlyContinue + New-ItemProperty $People -Name PeopleBand -Value 0 -Verbose + } + + #Disables suggestions on start menu + Write-Output "Disabling suggestions on the Start Menu" + $Suggestions = 'HKCU:\Software\Microsoft\Windows\CurrentVersion\ContentDeliveryManager' + If (Test-Path $Suggestions) { + Set-ItemProperty $Suggestions -Name SystemPaneSuggestionsEnabled -Value 0 -Verbose + } + + #Loads the registry keys/values below into the NTUSER.DAT file which prevents the apps from redownloading. Credit to a60wattfish + reg load HKU\Default_User C:\Users\Default\NTUSER.DAT + Set-ItemProperty -Path Registry::HKU\Default_User\SOFTWARE\Microsoft\Windows\CurrentVersion\ContentDeliveryManager -Name SystemPaneSuggestionsEnabled -Value 0 + Set-ItemProperty -Path Registry::HKU\Default_User\SOFTWARE\Microsoft\Windows\CurrentVersion\ContentDeliveryManager -Name PreInstalledAppsEnabled -Value 0 + Set-ItemProperty -Path Registry::HKU\Default_User\SOFTWARE\Microsoft\Windows\CurrentVersion\ContentDeliveryManager -Name OemPreInstalledAppsEnabled -Value 0 + reg unload HKU\Default_User + + #Disables scheduled tasks that are considered unnecessary + Write-Output "Disabling scheduled tasks" + #Get-ScheduledTask -TaskName XblGameSaveTaskLogon | Disable-ScheduledTask -ErrorAction SilentlyContinue + Get-ScheduledTask -TaskName XblGameSaveTask | Disable-ScheduledTask -ErrorAction SilentlyContinue + Get-ScheduledTask -TaskName Consolidator | Disable-ScheduledTask -ErrorAction SilentlyContinue + Get-ScheduledTask -TaskName UsbCeip | Disable-ScheduledTask -ErrorAction SilentlyContinue + Get-ScheduledTask -TaskName DmClient | Disable-ScheduledTask -ErrorAction SilentlyContinue + Get-ScheduledTask -TaskName DmClientOnScenarioDownload | Disable-ScheduledTask -ErrorAction SilentlyContinue + } + + #This includes fixes by xsisbest + Function FixWhitelistedApps { + + If (!(Get-AppxPackage -AllUsers | Select Microsoft.Paint3D, Microsoft.MSPaint, Microsoft.WindowsCalculator, Microsoft.WindowsStore, Microsoft.MicrosoftStickyNotes, Microsoft.WindowsSoundRecorder, Microsoft.Windows.Photos)) { + + #Credit to abulgatz for the 4 lines of code + Get-AppxPackage -allusers Microsoft.Paint3D | Foreach {Add-AppxPackage -DisableDevelopmentMode -Register "$($_.InstallLocation)\AppXManifest.xml"} + Get-AppxPackage -allusers Microsoft.MSPaint | Foreach {Add-AppxPackage -DisableDevelopmentMode -Register "$($_.InstallLocation)\AppXManifest.xml"} + Get-AppxPackage -allusers Microsoft.WindowsCalculator | Foreach {Add-AppxPackage -DisableDevelopmentMode -Register "$($_.InstallLocation)\AppXManifest.xml"} + Get-AppxPackage -allusers Microsoft.WindowsStore | Foreach {Add-AppxPackage -DisableDevelopmentMode -Register "$($_.InstallLocation)\AppXManifest.xml"} + Get-AppxPackage -allusers Microsoft.MicrosoftStickyNotes | Foreach {Add-AppxPackage -DisableDevelopmentMode -Register "$($_.InstallLocation)\AppXManifest.xml"} + Get-AppxPackage -allusers Microsoft.WindowsSoundRecorder | Foreach {Add-AppxPackage -DisableDevelopmentMode -Register "$($_.InstallLocation)\AppXManifest.xml"} + Get-AppxPackage -allusers Microsoft.Windows.Photos | Foreach {Add-AppxPackage -DisableDevelopmentMode -Register "$($_.InstallLocation)\AppXManifest.xml"} + } + } + + Function CheckService { + + If (Get-Service -Name dmwappushservice | Where-Object {$_.Status -eq "Stopped"}) { + Start-Service -Name dmwappushservice + } + } + + Write-Output "Initiating Sysprep" + Begin-SysPrep + Write-Output "Removing bloatware apps." + DebloatAll + DebloatBlacklist + Write-Output "Removing leftover bloatware registry keys." + Remove-Keys + Write-Output "Checking to see if any Whitelisted Apps were removed, and if so re-adding them." + FixWhitelistedApps + Write-Output "Stopping telemetry, disabling unneccessary scheduled tasks, and preventing bloatware from returning." + Protect-Privacy + #Write-Output "Stopping Edge from taking over as the default PDF Viewer." + #Stop-EdgePDF + Write-Output "Finished all tasks." + + }) +$RemoveBloatNoBlacklist.Add_Click( { + $ErrorActionPreference = 'silentlycontinue' + #This function finds any AppX/AppXProvisioned package and uninstalls it, except for Freshpaint, Windows Calculator, Windows Store, and Windows Photos. + #Also, to note - This does NOT remove essential system services/software/etc such as .NET framework installations, Cortana, Edge, etc. + + #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. + + param ( + [switch]$Debloat, [switch]$SysPrep + ) + + Function Begin-SysPrep { + + param([switch]$SysPrep) + Write-Verbose -Message ('Starting Sysprep Fixes') + + # Disable Windows Store Automatic Updates + Write-Verbose -Message "Adding Registry key to Disable Windows Store Automatic Updates" + $registryPath = "HKLM:\SOFTWARE\Policies\Microsoft\WindowsStore" + If (!(Test-Path $registryPath)) { + Mkdir $registryPath -ErrorAction SilentlyContinue + New-ItemProperty $registryPath -Name AutoDownload -Value 2 + } + Else { + Set-ItemProperty $registryPath -Name AutoDownload -Value 2 + } + #Stop WindowsStore Installer Service and set to Disabled + Write-Verbose -Message ('Stopping InstallService') + Stop-Service InstallService + Write-Verbose -Message ('Setting InstallService Startup to Disabled') + & Set-Service -Name InstallService -StartupType Disabled + } + + #Creates a PSDrive to be able to access the 'HKCR' tree + New-PSDrive -Name HKCR -PSProvider Registry -Root HKEY_CLASSES_ROOT + Function Start-Debloat { + + param([switch]$Debloat) + + #Removes AppxPackages + #Credit to Reddit user /u/GavinEke for a modified version of my whitelist code + [regex]$WhitelistedApps = 'Microsoft.ScreenSketch|Microsoft.Paint3D|Microsoft.MSPaint|Microsoft.WindowsCalculator|Microsoft.WindowsStore|Microsoft.MicrosoftStickyNotes|Microsoft.WindowsSoundRecorder|Microsoft.Windows.Photos|CanonicalGroupLimited.UbuntuonWindows' + Get-AppxPackage -AllUsers | Where-Object {$_.Name -NotMatch $WhitelistedApps} | Remove-AppxPackage -ErrorAction SilentlyContinue + # Run this again to avoid error on 1803 or having to reboot. + Get-AppxPackage -AllUsers | Where-Object {$_.Name -NotMatch $WhitelistedApps} | Remove-AppxPackage -ErrorAction SilentlyContinue + Get-AppxProvisionedPackage -Online | Where-Object {$_.PackageName -NotMatch $WhitelistedApps} | Remove-AppxProvisionedPackage -Online -ErrorAction SilentlyContinue + } + + Function Remove-Keys { + + Param([switch]$Debloat) + + #These are the registry keys that it will delete. + + $Keys = @( + + #Remove Background Tasks + "HKCR:\Extensions\ContractId\Windows.BackgroundTasks\PackageId\46928bounde.EclipseManager_2.2.4.51_neutral__a5h4egax66k6y" + "HKCR:\Extensions\ContractId\Windows.BackgroundTasks\PackageId\ActiproSoftwareLLC.562882FEEB491_2.6.18.18_neutral__24pqs290vpjk0" + "HKCR:\Extensions\ContractId\Windows.BackgroundTasks\PackageId\Microsoft.MicrosoftOfficeHub_17.7909.7600.0_x64__8wekyb3d8bbwe" + "HKCR:\Extensions\ContractId\Windows.BackgroundTasks\PackageId\Microsoft.PPIProjection_10.0.15063.0_neutral_neutral_cw5n1h2txyewy" + "HKCR:\Extensions\ContractId\Windows.BackgroundTasks\PackageId\Microsoft.XboxGameCallableUI_1000.15063.0.0_neutral_neutral_cw5n1h2txyewy" + "HKCR:\Extensions\ContractId\Windows.BackgroundTasks\PackageId\Microsoft.XboxGameCallableUI_1000.16299.15.0_neutral_neutral_cw5n1h2txyewy" + + #Windows File + "HKCR:\Extensions\ContractId\Windows.File\PackageId\ActiproSoftwareLLC.562882FEEB491_2.6.18.18_neutral__24pqs290vpjk0" + + #Registry keys to delete if they aren't uninstalled by RemoveAppXPackage/RemoveAppXProvisionedPackage + "HKCR:\Extensions\ContractId\Windows.Launch\PackageId\46928bounde.EclipseManager_2.2.4.51_neutral__a5h4egax66k6y" + "HKCR:\Extensions\ContractId\Windows.Launch\PackageId\ActiproSoftwareLLC.562882FEEB491_2.6.18.18_neutral__24pqs290vpjk0" + "HKCR:\Extensions\ContractId\Windows.Launch\PackageId\Microsoft.PPIProjection_10.0.15063.0_neutral_neutral_cw5n1h2txyewy" + "HKCR:\Extensions\ContractId\Windows.Launch\PackageId\Microsoft.XboxGameCallableUI_1000.15063.0.0_neutral_neutral_cw5n1h2txyewy" + "HKCR:\Extensions\ContractId\Windows.Launch\PackageId\Microsoft.XboxGameCallableUI_1000.16299.15.0_neutral_neutral_cw5n1h2txyewy" + + #Scheduled Tasks to delete + "HKCR:\Extensions\ContractId\Windows.PreInstalledConfigTask\PackageId\Microsoft.MicrosoftOfficeHub_17.7909.7600.0_x64__8wekyb3d8bbwe" + + #Windows Protocol Keys + "HKCR:\Extensions\ContractId\Windows.Protocol\PackageId\ActiproSoftwareLLC.562882FEEB491_2.6.18.18_neutral__24pqs290vpjk0" + "HKCR:\Extensions\ContractId\Windows.Protocol\PackageId\Microsoft.PPIProjection_10.0.15063.0_neutral_neutral_cw5n1h2txyewy" + "HKCR:\Extensions\ContractId\Windows.Protocol\PackageId\Microsoft.XboxGameCallableUI_1000.15063.0.0_neutral_neutral_cw5n1h2txyewy" + "HKCR:\Extensions\ContractId\Windows.Protocol\PackageId\Microsoft.XboxGameCallableUI_1000.16299.15.0_neutral_neutral_cw5n1h2txyewy" + + #Windows Share Target + "HKCR:\Extensions\ContractId\Windows.ShareTarget\PackageId\ActiproSoftwareLLC.562882FEEB491_2.6.18.18_neutral__24pqs290vpjk0" + ) + + #This writes the output of each key it is removing and also removes the keys listed above. + ForEach ($Key in $Keys) { + Write-Output "Removing $Key from registry" + Remove-Item $Key -Recurse -ErrorAction SilentlyContinue + } + } + + Function Protect-Privacy { + + Param([switch]$Debloat) + + #Creates a PSDrive to be able to access the 'HKCR' tree + New-PSDrive -Name HKCR -PSProvider Registry -Root HKEY_CLASSES_ROOT + + #Disables Windows Feedback Experience + Write-Output "Disabling Windows Feedback Experience program" + $Advertising = 'HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\AdvertisingInfo' + If (Test-Path $Advertising) { + Set-ItemProperty $Advertising -Name Enabled -Value 0 -Verbose + } + + #Stops Cortana from being used as part of your Windows Search Function + Write-Output "Stopping Cortana from being used as part of your Windows Search Function" + $Search = 'HKLM:\SOFTWARE\Policies\Microsoft\Windows\Windows Search' + If (Test-Path $Search) { + Set-ItemProperty $Search -Name AllowCortana -Value 0 -Verbose + } + + #Stops the Windows Feedback Experience from sending anonymous data + Write-Output "Stopping the Windows Feedback Experience program" + $Period1 = 'HKCU:\Software\Microsoft\Siuf' + $Period2 = 'HKCU:\Software\Microsoft\Siuf\Rules' + $Period3 = 'HKCU:\Software\Microsoft\Siuf\Rules\PeriodInNanoSeconds' + If (!(Test-Path $Period3)) { + mkdir $Period1 -ErrorAction SilentlyContinue + mkdir $Period2 -ErrorAction SilentlyContinue + mkdir $Period3 -ErrorAction SilentlyContinue + New-ItemProperty $Period3 -Name PeriodInNanoSeconds -Value 0 -Verbose -ErrorAction SilentlyContinue + } + + Write-Output "Adding Registry key to prevent bloatware apps from returning" + #Prevents bloatware applications from returning + $registryPath = "HKLM:\SOFTWARE\Policies\Microsoft\Windows\CloudContent" + If (!(Test-Path $registryPath)) { + Mkdir $registryPath -ErrorAction SilentlyContinue + New-ItemProperty $registryPath -Name DisableWindowsConsumerFeatures -Value 1 -Verbose -ErrorAction SilentlyContinue + } + + Write-Output "Setting Mixed Reality Portal value to 0 so that you can uninstall it in Settings" + $Holo = 'HKCU:\Software\Microsoft\Windows\CurrentVersion\Holographic' + If (Test-Path $Holo) { + Set-ItemProperty $Holo -Name FirstRunSucceeded -Value 0 -Verbose + } + + #Disables live tiles + Write-Output "Disabling live tiles" + $Live = 'HKCU:\SOFTWARE\Policies\Microsoft\Windows\CurrentVersion\PushNotifications' + If (!(Test-Path $Live)) { + mkdir $Live -ErrorAction SilentlyContinue + New-ItemProperty $Live -Name NoTileApplicationNotification -Value 1 -Verbose + } + + #Turns off Data Collection via the AllowTelemtry key by changing it to 0 + Write-Output "Turning off Data Collection" + $DataCollection = 'HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\Policies\DataCollection' + If (Test-Path $DataCollection) { + Set-ItemProperty $DataCollection -Name AllowTelemetry -Value 0 -Verbose + } + + #Disables People icon on Taskbar + Write-Output "Disabling People icon on Taskbar" + $People = 'HKCU:\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\Advanced\People' + If (!(Test-Path $People)) { + mkdir $People -ErrorAction SilentlyContinue + New-ItemProperty $People -Name PeopleBand -Value 0 -Verbose + } + + #Disables suggestions on start menu + Write-Output "Disabling suggestions on the Start Menu" + $Suggestions = 'HKCU:\Software\Microsoft\Windows\CurrentVersion\ContentDeliveryManager' + If (Test-Path $Suggestions) { + Set-ItemProperty $Suggestions -Name SystemPaneSuggestionsEnabled -Value 0 -Verbose + } + + #Loads the registry keys/values below into the NTUSER.DAT file which prevents the apps from redownloading. Credit to a60wattfish + reg load HKU\Default_User C:\Users\Default\NTUSER.DAT + Set-ItemProperty -Path Registry::HKU\Default_User\SOFTWARE\Microsoft\Windows\CurrentVersion\ContentDeliveryManager -Name SystemPaneSuggestionsEnabled -Value 0 + Set-ItemProperty -Path Registry::HKU\Default_User\SOFTWARE\Microsoft\Windows\CurrentVersion\ContentDeliveryManager -Name PreInstalledAppsEnabled -Value 0 + Set-ItemProperty -Path Registry::HKU\Default_User\SOFTWARE\Microsoft\Windows\CurrentVersion\ContentDeliveryManager -Name OemPreInstalledAppsEnabled -Value 0 + reg unload HKU\Default_User + + #Disables scheduled tasks that are considered unnecessary + Write-Output "Disabling scheduled tasks" + #Get-ScheduledTask -TaskName XblGameSaveTaskLogon | Disable-ScheduledTask -ErrorAction SilentlyContinue + Get-ScheduledTask -TaskName XblGameSaveTask | Disable-ScheduledTask -ErrorAction SilentlyContinue + Get-ScheduledTask -TaskName Consolidator | Disable-ScheduledTask -ErrorAction SilentlyContinue + Get-ScheduledTask -TaskName UsbCeip | Disable-ScheduledTask -ErrorAction SilentlyContinue + Get-ScheduledTask -TaskName DmClient | Disable-ScheduledTask -ErrorAction SilentlyContinue + Get-ScheduledTask -TaskName DmClientOnScenarioDownload | Disable-ScheduledTask -ErrorAction SilentlyContinue + } + + #This includes fixes by xsisbest + Function FixWhitelistedApps { + + Param([switch]$Debloat) + + If (!(Get-AppxPackage -AllUsers | Select Microsoft.Paint3D, Microsoft.MSPaint, Microsoft.WindowsCalculator, Microsoft.WindowsStore, Microsoft.MicrosoftStickyNotes, Microsoft.WindowsSoundRecorder, Microsoft.Windows.Photos)) { + + #Credit to abulgatz for the 4 lines of code + Get-AppxPackage -allusers Microsoft.Paint3D | Foreach {Add-AppxPackage -DisableDevelopmentMode -Register "$($_.InstallLocation)\AppXManifest.xml"} + Get-AppxPackage -allusers Microsoft.MSPaint | Foreach {Add-AppxPackage -DisableDevelopmentMode -Register "$($_.InstallLocation)\AppXManifest.xml"} + Get-AppxPackage -allusers Microsoft.WindowsCalculator | Foreach {Add-AppxPackage -DisableDevelopmentMode -Register "$($_.InstallLocation)\AppXManifest.xml"} + Get-AppxPackage -allusers Microsoft.WindowsStore | Foreach {Add-AppxPackage -DisableDevelopmentMode -Register "$($_.InstallLocation)\AppXManifest.xml"} + Get-AppxPackage -allusers Microsoft.MicrosoftStickyNotes | Foreach {Add-AppxPackage -DisableDevelopmentMode -Register "$($_.InstallLocation)\AppXManifest.xml"} + Get-AppxPackage -allusers Microsoft.WindowsSoundRecorder | Foreach {Add-AppxPackage -DisableDevelopmentMode -Register "$($_.InstallLocation)\AppXManifest.xml"} + Get-AppxPackage -allusers Microsoft.Windows.Photos | Foreach {Add-AppxPackage -DisableDevelopmentMode -Register "$($_.InstallLocation)\AppXManifest.xml"} + } + } + + Function CheckService { + + Param([switch]$Debloat) + + If (Get-Service -Name dmwappushservice | Where-Object {$_.Status -eq "Stopped"}) { + Start-Service -Name dmwappushservice + } + } + Begin-SysPrep + Write-Output "Removing bloatware apps." + Start-Debloat + Write-Output "Removing leftover bloatware registry keys." + Remove-Keys + Write-Output "Checking to see if any Whitelisted Apps were removed, and if so re-adding them." + FixWhitelistedApps + Write-Output "Stopping telemetry, disabling unneccessary scheduled tasks, and preventing bloatware from returning." + Protect-Privacy + #Write-Output "Stopping Edge from taking over as the default PDF Viewer." + Write-Output "Checking to make sure that the service 'dmwappushservice' has been started." + CheckService + Write-Output "Finished all tasks." + + }) +$RevertChange.Add_Click( { + $ErrorActionPreference = 'silentlycontinue' + #This function will revert the changes you made when running the Start-Debloat function. + + #This line reinstalls all of the bloatware that was removed + Get-AppxPackage -AllUsers | ForEach {Add-AppxPackage -Verbose -DisableDevelopmentMode -Register "$($_.InstallLocation)\AppXManifest.xml"} + + #Tells Windows to enable your advertising information. + Write-Output "Re-enabling key to show advertisement information" + $Advertising = "HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\AdvertisingInfo" + If (Test-Path $Advertising) { + Set-ItemProperty $Advertising Enabled -Value 1 + } + + #Enables Cortana to be used as part of your Windows Search Function + Write-Output "Re-enabling Cortana to be used in your Windows Search" + $Search = "HKLM:\SOFTWARE\Policies\Microsoft\Windows\Windows Search" + If (Test-Path $Search) { + Set-ItemProperty $Search AllowCortana -Value 1 + } + + #Re-enables the Windows Feedback Experience for sending anonymous data + Write-Output "Re-enabling Windows Feedback Experience" + $Period = "HKCU:\Software\Microsoft\Siuf\Rules" + If (!(Test-Path $Period)) { + New-Item $Period + } + Set-ItemProperty $Period PeriodInNanoSeconds -Value 1 + + #Enables bloatware applications + Write-Output "Adding Registry key to allow bloatware apps to return" + $registryPath = "HKLM:\SOFTWARE\Policies\Microsoft\Windows\CloudContent" + If (!(Test-Path $registryPath)) { + New-Item $registryPath + } + Set-ItemProperty $registryPath DisableWindowsConsumerFeatures -Value 0 + + #Changes Mixed Reality Portal Key 'FirstRunSucceeded' to 1 + Write-Output "Setting Mixed Reality Portal value to 1" + $Holo = "HKCU:\Software\Microsoft\Windows\CurrentVersion\Holographic" + If (Test-Path $Holo) { + Set-ItemProperty $Holo FirstRunSucceeded -Value 1 + } + + #Re-enables live tiles + Write-Output "Enabling live tiles" + $Live = "HKCU:\SOFTWARE\Policies\Microsoft\Windows\CurrentVersion\PushNotifications" + If (!(Test-Path $Live)) { + New-Item $Live + } + Set-ItemProperty $Live NoTileApplicationNotification -Value 0 + + #Re-enables data collection + Write-Output "Re-enabling data collection" + $DataCollection = "HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\Policies\DataCollection" + If (!(Test-Path $DataCollection)) { + New-Item $DataCollection + } + Set-ItemProperty $DataCollection AllowTelemetry -Value 1 + + #Re-enables People Icon on Taskbar + Write-Output "Enabling People icon on Taskbar" + $People = "HKCU:\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\Advanced\People" + If (!(Test-Path $People)) { + New-Item $People + } + Set-ItemProperty $People PeopleBand -Value 1 + + #Re-enables suggestions on start menu + Write-Output "Enabling suggestions on the Start Menu" + $Suggestions = "HKCU:\Software\Microsoft\Windows\CurrentVersion\ContentDeliveryManager" + If (!(Test-Path $Suggestions)) { + New-Item $Suggestions + } + Set-ItemProperty $Suggestions SystemPaneSuggestionsEnabled -Value 1 + + #Re-enables scheduled tasks that were disabled when running the Debloat switch + Write-Output "Enabling scheduled tasks that were disabled" + Get-ScheduledTask XblGameSaveTaskLogon | Enable-ScheduledTask + Get-ScheduledTask XblGameSaveTask | Enable-ScheduledTask + Get-ScheduledTask Consolidator | Enable-ScheduledTask + Get-ScheduledTask UsbCeip | Enable-ScheduledTask + Get-ScheduledTask DmClient | Enable-ScheduledTask + Get-ScheduledTask DmClientOnScenarioDownload | Enable-ScheduledTask + + Write-Output "Re-enabling and starting WAP Push Service" + #Enable and start WAP Push Service + Set-Service "dmwappushservice" -StartupType Automatic + Start-Service "dmwappushservice" + + Write-Output "Re-enabling and starting the Diagnostics Tracking Service" + #Enabling the Diagnostics Tracking Service + Set-Service "DiagTrack" -StartupType Automatic + Start-Service "DiagTrack" + }) +$FixWhitelist.Add_Click( { + $ErrorActionPreference = 'silentlycontinue' + If (!(Get-AppxPackage -AllUsers | Select Microsoft.Paint3D, Microsoft.WindowsCalculator, Microsoft.WindowsStore, Microsoft.Windows.Photos)) { + + #Credit to abulgatz for these 4 lines of code + Get-AppxPackage -allusers Microsoft.Paint3D | Foreach {Add-AppxPackage -DisableDevelopmentMode -Register "$($_.InstallLocation)\AppXManifest.xml"} + Get-AppxPackage -allusers Microsoft.WindowsCalculator | Foreach {Add-AppxPackage -DisableDevelopmentMode -Register "$($_.InstallLocation)\AppXManifest.xml"} + Get-AppxPackage -allusers Microsoft.WindowsStore | Foreach {Add-AppxPackage -DisableDevelopmentMode -Register "$($_.InstallLocation)\AppXManifest.xml"} + Get-AppxPackage -allusers Microsoft.Windows.Photos | Foreach {Add-AppxPackage -DisableDevelopmentMode -Register "$($_.InstallLocation)\AppXManifest.xml"} + } + }) +$DisableCortana.Add_Click( { + $ErrorActionPreference = 'silentlycontinue' + Write-Host "Disabling Cortana" + $Cortana1 = "HKCU:\SOFTWARE\Microsoft\Personalization\Settings" + $Cortana2 = "HKCU:\SOFTWARE\Microsoft\InputPersonalization" + $Cortana3 = "HKCU:\SOFTWARE\Microsoft\InputPersonalization\TrainedDataStore" + If (!(Test-Path $Cortana1)) { + New-Item $Cortana1 + } + Set-ItemProperty $Cortana1 AcceptedPrivacyPolicy -Value 0 + If (!(Test-Path $Cortana2)) { + New-Item $Cortana2 + } + Set-ItemProperty $Cortana2 RestrictImplicitTextCollection -Value 1 + Set-ItemProperty $Cortana2 RestrictImplicitInkCollection -Value 1 + If (!(Test-Path $Cortana3)) { + New-Item $Cortana3 + } + Set-ItemProperty $Cortana3 HarvestContacts -Value 0 + }) +$StopEdgePDFTakeover.Add_Click( { + #Stops edge from taking over as the default .PDF viewer + Write-Output "Stopping Edge from taking over as the default .PDF viewer" + $NoPDF = "HKCR:\.pdf" + $NoProgids = "HKCR:\.pdf\OpenWithProgids" + $NoWithList = "HKCR:\.pdf\OpenWithList" + If (!(Get-ItemProperty $NoPDF NoOpenWith)) { + New-ItemProperty $NoPDF NoOpenWith + } + If (!(Get-ItemProperty $NoPDF NoStaticDefaultVerb)) { + New-ItemProperty $NoPDF NoStaticDefaultVerb + } + If (!(Get-ItemProperty $NoProgids NoOpenWith)) { + New-ItemProperty $NoProgids NoOpenWith + } + If (!(Get-ItemProperty $NoProgids NoStaticDefaultVerb)) { + New-ItemProperty $NoProgids NoStaticDefaultVerb + } + If (!(Get-ItemProperty $NoWithList NoOpenWith)) { + New-ItemProperty $NoWithList NoOpenWith + } + If (!(Get-ItemProperty $NoWithList NoStaticDefaultVerb)) { + New-ItemProperty $NoWithList NoStaticDefaultVerb + } + + #Appends an underscore '_' to the Registry key for Edge + $Edge = "HKCR:\AppXd4nrz8ff68srnhf9t5a8sbjyar1cr723_" + If (Test-Path $Edge) { + Set-Item $Edge AppXd4nrz8ff68srnhf9t5a8sbjyar1cr723_ + } + }) +$EnableCortana.Add_Click( { + $ErrorActionPreference = 'silentlycontinue' + Write-Host "Re-enabling Cortana" + $Cortana1 = "HKCU:\SOFTWARE\Microsoft\Personalization\Settings" + $Cortana2 = "HKCU:\SOFTWARE\Microsoft\InputPersonalization" + $Cortana3 = "HKCU:\SOFTWARE\Microsoft\InputPersonalization\TrainedDataStore" + If (!(Test-Path $Cortana1)) { + New-Item $Cortana1 + } + Set-ItemProperty $Cortana1 AcceptedPrivacyPolicy -Value 1 + If (!(Test-Path $Cortana2)) { + New-Item $Cortana2 + } + Set-ItemProperty $Cortana2 RestrictImplicitTextCollection -Value 0 + Set-ItemProperty $Cortana2 RestrictImplicitInkCollection -Value 0 + If (!(Test-Path $Cortana3)) { + New-Item $Cortana3 + } + Set-ItemProperty $Cortana3 HarvestContacts -Value 1 + }) +$EnableEdgePDFTakeover.Add_Click( { + New-PSDrive HKCR -PSProvider Registry -Root HKEY_CLASSES_ROOT + $ErrorActionPreference = 'silentlycontinue' + Write-Output "Setting Edge back to default" + $NoPDF = "HKCR:\.pdf" + $NoProgids = "HKCR:\.pdf\OpenWithProgids" + $NoWithList = "HKCR:\.pdf\OpenWithList" + #Sets edge back to default + If (Get-ItemProperty $NoPDF NoOpenWith) { + Remove-ItemProperty $NoPDF NoOpenWith + } + If (Get-ItemProperty $NoPDF NoStaticDefaultVerb) { + Remove-ItemProperty $NoPDF NoStaticDefaultVerb + } + If (Get-ItemProperty $NoProgids NoOpenWith) { + Remove-ItemProperty $NoProgids NoOpenWith + } + If (Get-ItemProperty $NoProgids NoStaticDefaultVerb) { + Remove-ItemProperty $NoProgids NoStaticDefaultVerb + } + If (Get-ItemProperty $NoWithList NoOpenWith) { + Remove-ItemProperty $NoWithList NoOpenWith + } + If (Get-ItemProperty $NoWithList NoStaticDefaultVerb) { + Remove-ItemProperty $NoWithList NoStaticDefaultVerb + } + + #Removes an underscore '_' from the Registry key for Edge + $Edge2 = "HKCR:\AppXd4nrz8ff68srnhf9t5a8sbjyar1cr723_" + If (Test-Path $Edge2) { + Set-Item $Edge2 AppXd4nrz8ff68srnhf9t5a8sbjyar1cr723 + } + }) +$DisableTelemetry.Add_Click( { + $ErrorActionPreference = 'silentlycontinue' + #Disables Windows Feedback Experience + Write-Output "Disabling Windows Feedback Experience program" + $Advertising = "HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\AdvertisingInfo" + If (Test-Path $Advertising) { + Set-ItemProperty $Advertising Enabled -Value 0 + } + + #Stops Cortana from being used as part of your Windows Search Function + Write-Output "Stopping Cortana from being used as part of your Windows Search Function" + $Search = "HKLM:\SOFTWARE\Policies\Microsoft\Windows\Windows Search" + If (Test-Path $Search) { + Set-ItemProperty $Search AllowCortana -Value 0 + } + + #Disables Web Search in Start Menu + Write-Output "Disabling Bing Search in Start Menu" + $WebSearch = "HKLM:\SOFTWARE\Policies\Microsoft\Windows\Windows Search" + Set-ItemProperty "HKCU:\SOFTWARE\Microsoft\Windows\CurrentVersion\Search" BingSearchEnabled -Value 0 + If (!(Test-Path $WebSearch)) { + New-Item $WebSearch + } + Set-ItemProperty $WebSearch DisableWebSearch -Value 1 + + #Stops the Windows Feedback Experience from sending anonymous data + Write-Output "Stopping the Windows Feedback Experience program" + $Period = "HKCU:\Software\Microsoft\Siuf\Rules" + If (!(Test-Path $Period)) { + New-Item $Period + } + Set-ItemProperty $Period PeriodInNanoSeconds -Value 0 + + #Prevents bloatware applications from returning and removes Start Menu suggestions + Write-Output "Adding Registry key to prevent bloatware apps from returning" + $registryPath = "HKLM:\SOFTWARE\Policies\Microsoft\Windows\CloudContent" + $registryOEM = "HKCU:\SOFTWARE\Microsoft\Windows\CurrentVersion\ContentDeliveryManager" + If (!(Test-Path $registryPath)) { + New-Item $registryPath + } + Set-ItemProperty $registryPath DisableWindowsConsumerFeatures -Value 1 + + If (!(Test-Path $registryOEM)) { + New-Item $registryOEM + } + Set-ItemProperty $registryOEM ContentDeliveryAllowed -Value 0 + Set-ItemProperty $registryOEM OemPreInstalledAppsEnabled -Value 0 + Set-ItemProperty $registryOEM PreInstalledAppsEnabled -Value 0 + Set-ItemProperty $registryOEM PreInstalledAppsEverEnabled -Value 0 + Set-ItemProperty $registryOEM SilentInstalledAppsEnabled -Value 0 + Set-ItemProperty $registryOEM SystemPaneSuggestionsEnabled -Value 0 + + #Preping mixed Reality Portal for removal + Write-Output "Setting Mixed Reality Portal value to 0 so that you can uninstall it in Settings" + $Holo = "HKCU:\Software\Microsoft\Windows\CurrentVersion\Holographic" + If (Test-Path $Holo) { + Set-ItemProperty $Holo FirstRunSucceeded -Value 0 + } + + #Disables Wi-fi Sense + Write-Output "Disabling Wi-Fi Sense" + $WifiSense1 = "HKLM:\SOFTWARE\Microsoft\PolicyManager\default\WiFi\AllowWiFiHotSpotReporting" + $WifiSense2 = "HKLM:\SOFTWARE\Microsoft\PolicyManager\default\WiFi\AllowAutoConnectToWiFiSenseHotspots" + $WifiSense3 = "HKLM:\SOFTWARE\Microsoft\WcmSvc\wifinetworkmanager\config" + If (!(Test-Path $WifiSense1)) { + New-Item $WifiSense1 + } + Set-ItemProperty $WifiSense1 Value -Value 0 + If (!(Test-Path $WifiSense2)) { + New-Item $WifiSense2 + } + Set-ItemProperty $WifiSense2 Value -Value 0 + Set-ItemProperty $WifiSense3 AutoConnectAllowedOEM -Value 0 + + #Disables live tiles + Write-Output "Disabling live tiles" + $Live = "HKCU:\SOFTWARE\Policies\Microsoft\Windows\CurrentVersion\PushNotifications" + If (!(Test-Path $Live)) { + New-Item $Live + } + Set-ItemProperty $Live NoTileApplicationNotification -Value 1 + + #Turns off Data Collection via the AllowTelemtry key by changing it to 0 + Write-Output "Turning off Data Collection" + $DataCollection1 = "HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\Policies\DataCollection" + $DataCollection2 = "HKLM:\SOFTWARE\Policies\Microsoft\Windows\DataCollection" + $DataCollection3 = "HKLM:\SOFTWARE\Wow6432Node\Microsoft\Windows\CurrentVersion\Policies\DataCollection" + If (Test-Path $DataCollection1) { + Set-ItemProperty $DataCollection1 AllowTelemetry -Value 0 + } + If (Test-Path $DataCollection2) { + Set-ItemProperty $DataCollection2 AllowTelemetry -Value 0 + } + If (Test-Path $DataCollection3) { + Set-ItemProperty $DataCollection3 AllowTelemetry -Value 0 + } + + #Disabling Location Tracking + Write-Output "Disabling Location Tracking" + $SensorState = "HKLM:\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Sensor\Overrides\{BFA794E4-F964-4FDB-90F6-51056BFE4B44}" + $LocationConfig = "HKLM:\SYSTEM\CurrentControlSet\Services\lfsvc\Service\Configuration" + If (!(Test-Path $SensorState)) { + New-Item $SensorState + } + Set-ItemProperty $SensorState SensorPermissionState -Value 0 + If (!(Test-Path $LocationConfig)) { + New-Item $LocationConfig + } + Set-ItemProperty $LocationConfig Status -Value 0 + + #Disables People icon on Taskbar + Write-Output "Disabling People icon on Taskbar" + $People = "HKCU:\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\Advanced\People" + If (!(Test-Path $People)) { + New-Item $People + } + Set-ItemProperty $People PeopleBand -Value 0 + + #Disables scheduled tasks that are considered unnecessary + Write-Output "Disabling scheduled tasks" + Get-ScheduledTask XblGameSaveTaskLogon | Disable-ScheduledTask + Get-ScheduledTask XblGameSaveTask | Disable-ScheduledTask + Get-ScheduledTask Consolidator | Disable-ScheduledTask + Get-ScheduledTask UsbCeip | Disable-ScheduledTask + Get-ScheduledTask DmClient | Disable-ScheduledTask + Get-ScheduledTask DmClientOnScenarioDownload | Disable-ScheduledTask + + Write-Output "Stopping and disabling WAP Push Service" + #Stop and disable WAP Push Service + Stop-Service "dmwappushservice" + Set-Service "dmwappushservice" -StartupType Disabled + + Write-Output "Stopping and disabling Diagnostics Tracking Service" + #Disabling the Diagnostics Tracking Service + Stop-Service "DiagTrack" + Set-Service "DiagTrack" -StartupType Disabled + }) +$RemoveRegkeys.Add_Click( { + $ErrorActionPreference = 'silentlycontinue' + $Keys = @( + + New-PSDrive HKCR -PSProvider Registry -Root HKEY_CLASSES_ROOT + #Remove Background Tasks + "HKCR:\Extensions\ContractId\Windows.BackgroundTasks\PackageId\46928bounde.EclipseManager_2.2.4.51_neutral__a5h4egax66k6y" + "HKCR:\Extensions\ContractId\Windows.BackgroundTasks\PackageId\ActiproSoftwareLLC.562882FEEB491_2.6.18.18_neutral__24pqs290vpjk0" + "HKCR:\Extensions\ContractId\Windows.BackgroundTasks\PackageId\Microsoft.MicrosoftOfficeHub_17.7909.7600.0_x64__8wekyb3d8bbwe" + "HKCR:\Extensions\ContractId\Windows.BackgroundTasks\PackageId\Microsoft.PPIProjection_10.0.15063.0_neutral_neutral_cw5n1h2txyewy" + "HKCR:\Extensions\ContractId\Windows.BackgroundTasks\PackageId\Microsoft.XboxGameCallableUI_1000.15063.0.0_neutral_neutral_cw5n1h2txyewy" + "HKCR:\Extensions\ContractId\Windows.BackgroundTasks\PackageId\Microsoft.XboxGameCallableUI_1000.16299.15.0_neutral_neutral_cw5n1h2txyewy" + + #Windows File + "HKCR:\Extensions\ContractId\Windows.File\PackageId\ActiproSoftwareLLC.562882FEEB491_2.6.18.18_neutral__24pqs290vpjk0" + + #Registry keys to delete if they aren't uninstalled by RemoveAppXPackage/RemoveAppXProvisionedPackage + "HKCR:\Extensions\ContractId\Windows.Launch\PackageId\46928bounde.EclipseManager_2.2.4.51_neutral__a5h4egax66k6y" + "HKCR:\Extensions\ContractId\Windows.Launch\PackageId\ActiproSoftwareLLC.562882FEEB491_2.6.18.18_neutral__24pqs290vpjk0" + "HKCR:\Extensions\ContractId\Windows.Launch\PackageId\Microsoft.PPIProjection_10.0.15063.0_neutral_neutral_cw5n1h2txyewy" + "HKCR:\Extensions\ContractId\Windows.Launch\PackageId\Microsoft.XboxGameCallableUI_1000.15063.0.0_neutral_neutral_cw5n1h2txyewy" + "HKCR:\Extensions\ContractId\Windows.Launch\PackageId\Microsoft.XboxGameCallableUI_1000.16299.15.0_neutral_neutral_cw5n1h2txyewy" + + #Scheduled Tasks to delete + "HKCR:\Extensions\ContractId\Windows.PreInstalledConfigTask\PackageId\Microsoft.MicrosoftOfficeHub_17.7909.7600.0_x64__8wekyb3d8bbwe" + + #Windows Protocol Keys + "HKCR:\Extensions\ContractId\Windows.Protocol\PackageId\ActiproSoftwareLLC.562882FEEB491_2.6.18.18_neutral__24pqs290vpjk0" + "HKCR:\Extensions\ContractId\Windows.Protocol\PackageId\Microsoft.PPIProjection_10.0.15063.0_neutral_neutral_cw5n1h2txyewy" + "HKCR:\Extensions\ContractId\Windows.Protocol\PackageId\Microsoft.XboxGameCallableUI_1000.15063.0.0_neutral_neutral_cw5n1h2txyewy" + "HKCR:\Extensions\ContractId\Windows.Protocol\PackageId\Microsoft.XboxGameCallableUI_1000.16299.15.0_neutral_neutral_cw5n1h2txyewy" + + #Windows Share Target + "HKCR:\Extensions\ContractId\Windows.ShareTarget\PackageId\ActiproSoftwareLLC.562882FEEB491_2.6.18.18_neutral__24pqs290vpjk0" + ) + + #This writes the output of each key it is removing and also removes the keys listed above. + ForEach ($Key in $Keys) { + Write-Output "Removing $Key from registry" + Remove-Item $Key -Recurse + } + }) +$RemoveOnedrive.Add_Click( { + Write-Output "Uninstalling OneDrive" + + New-PSDrive HKCR -PSProvider Registry -Root HKEY_CLASSES_ROOT + $onedrive = "$env:SYSTEMROOT\SysWOW64\OneDriveSetup.exe" + $ExplorerReg1 = "HKCR:\CLSID\{018D5C66-4533-4307-9B53-224DE2ED1FE6}" + $ExplorerReg2 = "HKCR:\Wow6432Node\CLSID\{018D5C66-4533-4307-9B53-224DE2ED1FE6}" + Stop-Process -Name "OneDrive*" + Start-Sleep 2 + If (!(Test-Path $onedrive)) { + $onedrive = "$env:SYSTEMROOT\System32\OneDriveSetup.exe" + } + Start-Process $onedrive "/uninstall" -NoNewWindow -Wait + Start-Sleep 2 + Write-Output "Stopping explorer" + Start-Sleep 1 + .\taskkill.exe /F /IM explorer.exe + Start-Sleep 3 + Write-Output "Removing leftover files" + Remove-Item "$env:USERPROFILE\OneDrive" -Force -Recurse + Remove-Item "$env:LOCALAPPDATA\Microsoft\OneDrive" -Force -Recurse + Remove-Item "$env:PROGRAMDATA\Microsoft OneDrive" -Force -Recurse + If (Test-Path "$env:SYSTEMDRIVE\OneDriveTemp") { + Remove-Item "$env:SYSTEMDRIVE\OneDriveTemp" -Force -Recurse + } + Write-Output "Removing OneDrive from windows explorer" + If (!(Test-Path $ExplorerReg1)) { + New-Item $ExplorerReg1 + } + Set-ItemProperty $ExplorerReg1 System.IsPinnedToNameSpaceTree -Value 0 + If (!(Test-Path $ExplorerReg2)) { + New-Item $ExplorerReg2 + } + Set-ItemProperty $ExplorerReg2 System.IsPinnedToNameSpaceTree -Value 0 + Write-Output "Restarting Explorer that was shut down before." + Start-Process explorer.exe -NoNewWindow + }) +#endregion events } + +#endregion GUI } + + +#Write your logic code here + +[void]$Form.ShowDialog() From 5f09edeeeff8023363fce208a134089c5ef7d7fd Mon Sep 17 00:00:00 2001 From: Richard Newton Date: Thu, 18 Oct 2018 20:06:23 -0700 Subject: [PATCH 02/15] Update Windows10DebloaterGUI --- Windows10DebloaterGUI | 8 -------- 1 file changed, 8 deletions(-) diff --git a/Windows10DebloaterGUI b/Windows10DebloaterGUI index c1efff3c..c33198da 100644 --- a/Windows10DebloaterGUI +++ b/Windows10DebloaterGUI @@ -1,8 +1,3 @@ -<# This form was created using POSHGUI.com a free online gui designer for PowerShell -.NAME - Untitled -#> - Add-Type -AssemblyName System.Windows.Forms [System.Windows.Forms.Application]::EnableVisualStyles() @@ -1144,7 +1139,4 @@ $RemoveOnedrive.Add_Click( { #endregion GUI } - -#Write your logic code here - [void]$Form.ShowDialog() From feb7f29cbd401c55e8099d666943690b934aa525 Mon Sep 17 00:00:00 2001 From: Richard Newton Date: Sun, 28 Oct 2018 11:37:52 -0700 Subject: [PATCH 03/15] Added .ps1 extension to Windows10DebloaterGUI --- Windows10DebloaterGUI => Windows10DebloaterGUI.ps1 | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename Windows10DebloaterGUI => Windows10DebloaterGUI.ps1 (100%) diff --git a/Windows10DebloaterGUI b/Windows10DebloaterGUI.ps1 similarity index 100% rename from Windows10DebloaterGUI rename to Windows10DebloaterGUI.ps1 From f900e00af160007afbb9f8c4a77d9fa4bf5df267 Mon Sep 17 00:00:00 2001 From: Richard Newton Date: Sun, 28 Oct 2018 12:21:45 -0700 Subject: [PATCH 04/15] Fixed Writing to console and Add_Click actions The application will now write to the host console properly and give updates as it does its work instead of just hanging and acting as if it is frozen. The $RemoveAllBloatware Add_Click now works properly as well as $RemoveBlacklist and the associated Add_Click. The console will put a space in between lines when each Add_Click action is finished for better reading and font visibility. --- Windows10DebloaterGUI.ps1 | 219 ++++++++++++++++++++++---------------- 1 file changed, 125 insertions(+), 94 deletions(-) diff --git a/Windows10DebloaterGUI.ps1 b/Windows10DebloaterGUI.ps1 index c33198da..9cf84559 100644 --- a/Windows10DebloaterGUI.ps1 +++ b/Windows10DebloaterGUI.ps1 @@ -16,12 +16,12 @@ $Debloat.height = 10 $Debloat.location = New-Object System.Drawing.Point(9, 8) $Debloat.Font = 'Microsoft Sans Serif,12,style=Bold,Underline' -$RemoveDebloat = New-Object system.Windows.Forms.Button -$RemoveDebloat.text = "Remove All Bloatware" -$RemoveDebloat.width = 142 -$RemoveDebloat.height = 40 -$RemoveDebloat.location = New-Object System.Drawing.Point(8, 32) -$RemoveDebloat.Font = 'Microsoft Sans Serif,10' +$RemoveAllBloatware = New-Object system.Windows.Forms.Button +$RemoveAllBloatware.text = "Remove All Bloatware" +$RemoveAllBloatware.width = 142 +$RemoveAllBloatware.height = 40 +$RemoveAllBloatware.location = New-Object System.Drawing.Point(8, 32) +$RemoveAllBloatware.Font = 'Microsoft Sans Serif,10' $RemoveBlacklist = New-Object system.Windows.Forms.Button $RemoveBlacklist.text = "Remove Bloatware With Blacklist" @@ -116,10 +116,10 @@ $RemoveBloatNoBlacklist.height = 39 $RemoveBloatNoBlacklist.location = New-Object System.Drawing.Point(9, 123) $RemoveBloatNoBlacklist.Font = 'Microsoft Sans Serif,10' -$Form.controls.AddRange(@($Debloat, $RemoveDebloat, $RemoveBlacklist, $Label1, $RevertChange, $Label2, $DisableCortana, $EnableCortana, $StopEdgePDFTakeover, $EnableEdgePDFTakeover, $DisableTelemetry, $RemoveRegkeys, $RemoveOnedrive, $FixWhitelist, $RemoveBloatNoBlacklist)) +$Form.controls.AddRange(@($Debloat, $RemoveAllBloatware, $RemoveBlacklist, $Label1, $RevertChange, $Label2, $DisableCortana, $EnableCortana, $StopEdgePDFTakeover, $EnableEdgePDFTakeover, $DisableTelemetry, $RemoveRegkeys, $RemoveOnedrive, $FixWhitelist, $RemoveBloatNoBlacklist)) #region gui events { -$RemoveDebloat.Add_Click( { +$RemoveBlacklist.Add_Click( { $ErrorActionPreference = 'silentlycontinue' Function DebloatBlacklist { [CmdletBinding()] @@ -188,23 +188,28 @@ $RemoveDebloat.Add_Click( { ) foreach ($Bloat in $Bloatware) { Get-AppxPackage -Name $Bloat| Remove-AppxPackage -ErrorAction SilentlyContinue - Get-AppxProvisionedPackage -Online | Where-Object DisplayName -like $Debloat | Remove-AppxProvisionedPackage -Online -ErrorAction SilentlyContinue - Write-Output "Trying to remove $Bloat." + Get-AppxProvisionedPackage -Online | Where-Object DisplayName -like $Bloat | Remove-AppxProvisionedPackage -Online -ErrorAction SilentlyContinue + Write-Host "Trying to remove $Bloat." + Write-Host "Bloatware removed! `n" } } + Write-Host "Removing Bloatware with a specific blacklist." + DebloatBlacklist }) -$RemoveBlacklist.Add_Click( { +$RemoveAllBloatware.Add_Click( { + $ErrorActionPreference = 'silentlycontinue' #This function finds any AppX/AppXProvisioned package and uninstalls it, except for Freshpaint, Windows Calculator, Windows Store, and Windows Photos. #Also, to note - This does NOT remove essential system services/software/etc such as .NET framework installations, Cortana, Edge, etc. #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. Function Begin-SysPrep { + $ErrorActionPreference = 'silentlycontinue' - Write-Verbose -Message ('Starting Sysprep Fixes') + Write-Host -Message ('Starting Sysprep Fixes') # Disable Windows Store Automatic Updates - Write-Verbose -Message "Adding Registry key to Disable Windows Store Automatic Updates" + Write-Host -Message "Adding Registry key to Disable Windows Store Automatic Updates" $registryPath = "HKLM:\SOFTWARE\Policies\Microsoft\WindowsStore" If (!(Test-Path $registryPath)) { Mkdir $registryPath -ErrorAction SilentlyContinue @@ -214,9 +219,9 @@ $RemoveBlacklist.Add_Click( { Set-ItemProperty $registryPath -Name AutoDownload -Value 2 } #Stop WindowsStore Installer Service and set to Disabled - Write-Verbose -Message ('Stopping InstallService') + Write-Host -Message ('Stopping InstallService') Stop-Service InstallService - Write-Verbose -Message ('Setting InstallService Startup to Disabled') + Write-Host -Message ('Setting InstallService Startup to Disabled') & Set-Service -Name InstallService -StartupType Disabled } @@ -237,9 +242,10 @@ $RemoveBlacklist.Add_Click( { #Creates a PSDrive to be able to access the 'HKCR' tree New-PSDrive -Name HKCR -PSProvider Registry -Root HKEY_CLASSES_ROOT Function DebloatBlacklist { + $ErrorActionPreference = 'silentlycontinue' $Bloatware = @( - + #Unnecessary Windows 10 AppX Apps "Microsoft.BingNews" "Microsoft.DesktopAppInstaller" @@ -300,12 +306,13 @@ $RemoveBlacklist.Add_Click( { ) foreach ($Bloat in $Bloatware) { Get-AppxPackage -Name $Bloat| Remove-AppxPackage -ErrorAction SilentlyContinue - Get-AppxProvisionedPackage -Online | Where-Object DisplayName -like $Debloat | Remove-AppxProvisionedPackage -Online -ErrorAction SilentlyContinue - Write-Output "Trying to remove $Bloat." + Get-AppxProvisionedPackage -Online | Where-Object DisplayName -like $Bloat | Remove-AppxProvisionedPackage -Online -ErrorAction SilentlyContinue + Write-Host "Trying to remove $Bloat." } } - Function Remove-Keys { + Function Remove-Keys { + $ErrorActionPreference = 'silentlycontinue' #These are the registry keys that it will delete. @@ -344,32 +351,33 @@ $RemoveBlacklist.Add_Click( { #This writes the output of each key it is removing and also removes the keys listed above. ForEach ($Key in $Keys) { - Write-Output "Removing $Key from registry" + Write-Host "Removing $Key from registry" Remove-Item $Key -Recurse -ErrorAction SilentlyContinue } } Function Protect-Privacy { + $ErrorActionPreference = 'silentlycontinue' #Creates a PSDrive to be able to access the 'HKCR' tree New-PSDrive -Name HKCR -PSProvider Registry -Root HKEY_CLASSES_ROOT #Disables Windows Feedback Experience - Write-Output "Disabling Windows Feedback Experience program" + Write-Host "Disabling Windows Feedback Experience program" $Advertising = 'HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\AdvertisingInfo' If (Test-Path $Advertising) { Set-ItemProperty $Advertising -Name Enabled -Value 0 -Verbose } #Stops Cortana from being used as part of your Windows Search Function - Write-Output "Stopping Cortana from being used as part of your Windows Search Function" + Write-Host "Stopping Cortana from being used as part of your Windows Search Function" $Search = 'HKLM:\SOFTWARE\Policies\Microsoft\Windows\Windows Search' If (Test-Path $Search) { Set-ItemProperty $Search -Name AllowCortana -Value 0 -Verbose } #Stops the Windows Feedback Experience from sending anonymous data - Write-Output "Stopping the Windows Feedback Experience program" + Write-Host "Stopping the Windows Feedback Experience program" $Period1 = 'HKCU:\Software\Microsoft\Siuf' $Period2 = 'HKCU:\Software\Microsoft\Siuf\Rules' $Period3 = 'HKCU:\Software\Microsoft\Siuf\Rules\PeriodInNanoSeconds' @@ -380,7 +388,7 @@ $RemoveBlacklist.Add_Click( { New-ItemProperty $Period3 -Name PeriodInNanoSeconds -Value 0 -Verbose -ErrorAction SilentlyContinue } - Write-Output "Adding Registry key to prevent bloatware apps from returning" + Write-Host "Adding Registry key to prevent bloatware apps from returning" #Prevents bloatware applications from returning $registryPath = "HKLM:\SOFTWARE\Policies\Microsoft\Windows\CloudContent" If (!(Test-Path $registryPath)) { @@ -388,14 +396,14 @@ $RemoveBlacklist.Add_Click( { New-ItemProperty $registryPath -Name DisableWindowsConsumerFeatures -Value 1 -Verbose -ErrorAction SilentlyContinue } - Write-Output "Setting Mixed Reality Portal value to 0 so that you can uninstall it in Settings" + Write-Host "Setting Mixed Reality Portal value to 0 so that you can uninstall it in Settings" $Holo = 'HKCU:\Software\Microsoft\Windows\CurrentVersion\Holographic' If (Test-Path $Holo) { Set-ItemProperty $Holo -Name FirstRunSucceeded -Value 0 -Verbose } #Disables live tiles - Write-Output "Disabling live tiles" + Write-Host "Disabling live tiles" $Live = 'HKCU:\SOFTWARE\Policies\Microsoft\Windows\CurrentVersion\PushNotifications' If (!(Test-Path $Live)) { mkdir $Live -ErrorAction SilentlyContinue @@ -403,14 +411,14 @@ $RemoveBlacklist.Add_Click( { } #Turns off Data Collection via the AllowTelemtry key by changing it to 0 - Write-Output "Turning off Data Collection" + Write-Host "Turning off Data Collection" $DataCollection = 'HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\Policies\DataCollection' If (Test-Path $DataCollection) { Set-ItemProperty $DataCollection -Name AllowTelemetry -Value 0 -Verbose } #Disables People icon on Taskbar - Write-Output "Disabling People icon on Taskbar" + Write-Host "Disabling People icon on Taskbar" $People = 'HKCU:\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\Advanced\People' If (!(Test-Path $People)) { mkdir $People -ErrorAction SilentlyContinue @@ -418,7 +426,7 @@ $RemoveBlacklist.Add_Click( { } #Disables suggestions on start menu - Write-Output "Disabling suggestions on the Start Menu" + Write-Host "Disabling suggestions on the Start Menu" $Suggestions = 'HKCU:\Software\Microsoft\Windows\CurrentVersion\ContentDeliveryManager' If (Test-Path $Suggestions) { Set-ItemProperty $Suggestions -Name SystemPaneSuggestionsEnabled -Value 0 -Verbose @@ -432,7 +440,7 @@ $RemoveBlacklist.Add_Click( { reg unload HKU\Default_User #Disables scheduled tasks that are considered unnecessary - Write-Output "Disabling scheduled tasks" + Write-Host "Disabling scheduled tasks" #Get-ScheduledTask -TaskName XblGameSaveTaskLogon | Disable-ScheduledTask -ErrorAction SilentlyContinue Get-ScheduledTask -TaskName XblGameSaveTask | Disable-ScheduledTask -ErrorAction SilentlyContinue Get-ScheduledTask -TaskName Consolidator | Disable-ScheduledTask -ErrorAction SilentlyContinue @@ -443,6 +451,7 @@ $RemoveBlacklist.Add_Click( { #This includes fixes by xsisbest Function FixWhitelistedApps { + $ErrorActionPreference = 'silentlycontinue' If (!(Get-AppxPackage -AllUsers | Select Microsoft.Paint3D, Microsoft.MSPaint, Microsoft.WindowsCalculator, Microsoft.WindowsStore, Microsoft.MicrosoftStickyNotes, Microsoft.WindowsSoundRecorder, Microsoft.Windows.Photos)) { @@ -464,22 +473,22 @@ $RemoveBlacklist.Add_Click( { } } - Write-Output "Initiating Sysprep" + Write-Host "Initiating Sysprep" Begin-SysPrep - Write-Output "Removing bloatware apps." + Write-Host "Removing bloatware apps." DebloatAll DebloatBlacklist - Write-Output "Removing leftover bloatware registry keys." + Write-Host "Removing leftover bloatware registry keys." Remove-Keys - Write-Output "Checking to see if any Whitelisted Apps were removed, and if so re-adding them." + Write-Host "Checking to see if any Whitelisted Apps were removed, and if so re-adding them." FixWhitelistedApps - Write-Output "Stopping telemetry, disabling unneccessary scheduled tasks, and preventing bloatware from returning." + Write-Host "Stopping telemetry, disabling unneccessary scheduled tasks, and preventing bloatware from returning." Protect-Privacy - #Write-Output "Stopping Edge from taking over as the default PDF Viewer." + #Write-Host "Stopping Edge from taking over as the default PDF Viewer." #Stop-EdgePDF - Write-Output "Finished all tasks." + Write-Host "Finished all tasks. `n" - }) + } ) $RemoveBloatNoBlacklist.Add_Click( { $ErrorActionPreference = 'silentlycontinue' #This function finds any AppX/AppXProvisioned package and uninstalls it, except for Freshpaint, Windows Calculator, Windows Store, and Windows Photos. @@ -492,12 +501,13 @@ $RemoveBloatNoBlacklist.Add_Click( { ) Function Begin-SysPrep { + $ErrorActionPreference = 'silentlycontinue' param([switch]$SysPrep) - Write-Verbose -Message ('Starting Sysprep Fixes') + Write-Host -Message ('Starting Sysprep Fixes') # Disable Windows Store Automatic Updates - Write-Verbose -Message "Adding Registry key to Disable Windows Store Automatic Updates" + Write-Host -Message "Adding Registry key to Disable Windows Store Automatic Updates" $registryPath = "HKLM:\SOFTWARE\Policies\Microsoft\WindowsStore" If (!(Test-Path $registryPath)) { Mkdir $registryPath -ErrorAction SilentlyContinue @@ -507,15 +517,16 @@ $RemoveBloatNoBlacklist.Add_Click( { Set-ItemProperty $registryPath -Name AutoDownload -Value 2 } #Stop WindowsStore Installer Service and set to Disabled - Write-Verbose -Message ('Stopping InstallService') + Write-Host -Message ('Stopping InstallService') Stop-Service InstallService - Write-Verbose -Message ('Setting InstallService Startup to Disabled') + Write-Host -Message ('Setting InstallService Startup to Disabled') & Set-Service -Name InstallService -StartupType Disabled } #Creates a PSDrive to be able to access the 'HKCR' tree New-PSDrive -Name HKCR -PSProvider Registry -Root HKEY_CLASSES_ROOT Function Start-Debloat { + $ErrorActionPreference = 'silentlycontinue' param([switch]$Debloat) @@ -529,6 +540,7 @@ $RemoveBloatNoBlacklist.Add_Click( { } Function Remove-Keys { + $ErrorActionPreference = 'silentlycontinue' Param([switch]$Debloat) @@ -569,12 +581,13 @@ $RemoveBloatNoBlacklist.Add_Click( { #This writes the output of each key it is removing and also removes the keys listed above. ForEach ($Key in $Keys) { - Write-Output "Removing $Key from registry" + Write-Host "Removing $Key from registry" Remove-Item $Key -Recurse -ErrorAction SilentlyContinue } } Function Protect-Privacy { + $ErrorActionPreference = 'silentlycontinue' Param([switch]$Debloat) @@ -582,21 +595,21 @@ $RemoveBloatNoBlacklist.Add_Click( { New-PSDrive -Name HKCR -PSProvider Registry -Root HKEY_CLASSES_ROOT #Disables Windows Feedback Experience - Write-Output "Disabling Windows Feedback Experience program" + Write-Host "Disabling Windows Feedback Experience program" $Advertising = 'HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\AdvertisingInfo' If (Test-Path $Advertising) { Set-ItemProperty $Advertising -Name Enabled -Value 0 -Verbose } #Stops Cortana from being used as part of your Windows Search Function - Write-Output "Stopping Cortana from being used as part of your Windows Search Function" + Write-Host "Stopping Cortana from being used as part of your Windows Search Function" $Search = 'HKLM:\SOFTWARE\Policies\Microsoft\Windows\Windows Search' If (Test-Path $Search) { Set-ItemProperty $Search -Name AllowCortana -Value 0 -Verbose } #Stops the Windows Feedback Experience from sending anonymous data - Write-Output "Stopping the Windows Feedback Experience program" + Write-Host "Stopping the Windows Feedback Experience program" $Period1 = 'HKCU:\Software\Microsoft\Siuf' $Period2 = 'HKCU:\Software\Microsoft\Siuf\Rules' $Period3 = 'HKCU:\Software\Microsoft\Siuf\Rules\PeriodInNanoSeconds' @@ -607,7 +620,7 @@ $RemoveBloatNoBlacklist.Add_Click( { New-ItemProperty $Period3 -Name PeriodInNanoSeconds -Value 0 -Verbose -ErrorAction SilentlyContinue } - Write-Output "Adding Registry key to prevent bloatware apps from returning" + Write-Host "Adding Registry key to prevent bloatware apps from returning" #Prevents bloatware applications from returning $registryPath = "HKLM:\SOFTWARE\Policies\Microsoft\Windows\CloudContent" If (!(Test-Path $registryPath)) { @@ -615,14 +628,14 @@ $RemoveBloatNoBlacklist.Add_Click( { New-ItemProperty $registryPath -Name DisableWindowsConsumerFeatures -Value 1 -Verbose -ErrorAction SilentlyContinue } - Write-Output "Setting Mixed Reality Portal value to 0 so that you can uninstall it in Settings" + Write-Host "Setting Mixed Reality Portal value to 0 so that you can uninstall it in Settings" $Holo = 'HKCU:\Software\Microsoft\Windows\CurrentVersion\Holographic' If (Test-Path $Holo) { Set-ItemProperty $Holo -Name FirstRunSucceeded -Value 0 -Verbose } #Disables live tiles - Write-Output "Disabling live tiles" + Write-Host "Disabling live tiles" $Live = 'HKCU:\SOFTWARE\Policies\Microsoft\Windows\CurrentVersion\PushNotifications' If (!(Test-Path $Live)) { mkdir $Live -ErrorAction SilentlyContinue @@ -630,14 +643,14 @@ $RemoveBloatNoBlacklist.Add_Click( { } #Turns off Data Collection via the AllowTelemtry key by changing it to 0 - Write-Output "Turning off Data Collection" + Write-Host "Turning off Data Collection" $DataCollection = 'HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\Policies\DataCollection' If (Test-Path $DataCollection) { Set-ItemProperty $DataCollection -Name AllowTelemetry -Value 0 -Verbose } #Disables People icon on Taskbar - Write-Output "Disabling People icon on Taskbar" + Write-Host "Disabling People icon on Taskbar" $People = 'HKCU:\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\Advanced\People' If (!(Test-Path $People)) { mkdir $People -ErrorAction SilentlyContinue @@ -645,7 +658,7 @@ $RemoveBloatNoBlacklist.Add_Click( { } #Disables suggestions on start menu - Write-Output "Disabling suggestions on the Start Menu" + Write-Host "Disabling suggestions on the Start Menu" $Suggestions = 'HKCU:\Software\Microsoft\Windows\CurrentVersion\ContentDeliveryManager' If (Test-Path $Suggestions) { Set-ItemProperty $Suggestions -Name SystemPaneSuggestionsEnabled -Value 0 -Verbose @@ -659,7 +672,7 @@ $RemoveBloatNoBlacklist.Add_Click( { reg unload HKU\Default_User #Disables scheduled tasks that are considered unnecessary - Write-Output "Disabling scheduled tasks" + Write-Host "Disabling scheduled tasks" #Get-ScheduledTask -TaskName XblGameSaveTaskLogon | Disable-ScheduledTask -ErrorAction SilentlyContinue Get-ScheduledTask -TaskName XblGameSaveTask | Disable-ScheduledTask -ErrorAction SilentlyContinue Get-ScheduledTask -TaskName Consolidator | Disable-ScheduledTask -ErrorAction SilentlyContinue @@ -695,18 +708,18 @@ $RemoveBloatNoBlacklist.Add_Click( { } } Begin-SysPrep - Write-Output "Removing bloatware apps." + Write-Host "Removing bloatware apps." Start-Debloat - Write-Output "Removing leftover bloatware registry keys." + Write-Host "Removing leftover bloatware registry keys." Remove-Keys - Write-Output "Checking to see if any Whitelisted Apps were removed, and if so re-adding them." + Write-Host "Checking to see if any Whitelisted Apps were removed, and if so re-adding them." FixWhitelistedApps - Write-Output "Stopping telemetry, disabling unneccessary scheduled tasks, and preventing bloatware from returning." + Write-Host "Stopping telemetry, disabling unneccessary scheduled tasks, and preventing bloatware from returning." Protect-Privacy - #Write-Output "Stopping Edge from taking over as the default PDF Viewer." - Write-Output "Checking to make sure that the service 'dmwappushservice' has been started." + #Write-Host "Stopping Edge from taking over as the default PDF Viewer." + Write-Host "Checking to make sure that the service 'dmwappushservice' has been started." CheckService - Write-Output "Finished all tasks." + Write-Host "Finished all tasks. `n" }) $RevertChange.Add_Click( { @@ -717,21 +730,21 @@ $RevertChange.Add_Click( { Get-AppxPackage -AllUsers | ForEach {Add-AppxPackage -Verbose -DisableDevelopmentMode -Register "$($_.InstallLocation)\AppXManifest.xml"} #Tells Windows to enable your advertising information. - Write-Output "Re-enabling key to show advertisement information" + Write-Host "Re-enabling key to show advertisement information" $Advertising = "HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\AdvertisingInfo" If (Test-Path $Advertising) { Set-ItemProperty $Advertising Enabled -Value 1 } #Enables Cortana to be used as part of your Windows Search Function - Write-Output "Re-enabling Cortana to be used in your Windows Search" + Write-Host "Re-enabling Cortana to be used in your Windows Search" $Search = "HKLM:\SOFTWARE\Policies\Microsoft\Windows\Windows Search" If (Test-Path $Search) { Set-ItemProperty $Search AllowCortana -Value 1 } #Re-enables the Windows Feedback Experience for sending anonymous data - Write-Output "Re-enabling Windows Feedback Experience" + Write-Host "Re-enabling Windows Feedback Experience" $Period = "HKCU:\Software\Microsoft\Siuf\Rules" If (!(Test-Path $Period)) { New-Item $Period @@ -739,7 +752,7 @@ $RevertChange.Add_Click( { Set-ItemProperty $Period PeriodInNanoSeconds -Value 1 #Enables bloatware applications - Write-Output "Adding Registry key to allow bloatware apps to return" + Write-Host "Adding Registry key to allow bloatware apps to return" $registryPath = "HKLM:\SOFTWARE\Policies\Microsoft\Windows\CloudContent" If (!(Test-Path $registryPath)) { New-Item $registryPath @@ -747,14 +760,14 @@ $RevertChange.Add_Click( { Set-ItemProperty $registryPath DisableWindowsConsumerFeatures -Value 0 #Changes Mixed Reality Portal Key 'FirstRunSucceeded' to 1 - Write-Output "Setting Mixed Reality Portal value to 1" + Write-Host "Setting Mixed Reality Portal value to 1" $Holo = "HKCU:\Software\Microsoft\Windows\CurrentVersion\Holographic" If (Test-Path $Holo) { Set-ItemProperty $Holo FirstRunSucceeded -Value 1 } #Re-enables live tiles - Write-Output "Enabling live tiles" + Write-Host "Enabling live tiles" $Live = "HKCU:\SOFTWARE\Policies\Microsoft\Windows\CurrentVersion\PushNotifications" If (!(Test-Path $Live)) { New-Item $Live @@ -762,7 +775,7 @@ $RevertChange.Add_Click( { Set-ItemProperty $Live NoTileApplicationNotification -Value 0 #Re-enables data collection - Write-Output "Re-enabling data collection" + Write-Host "Re-enabling data collection" $DataCollection = "HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\Policies\DataCollection" If (!(Test-Path $DataCollection)) { New-Item $DataCollection @@ -770,7 +783,7 @@ $RevertChange.Add_Click( { Set-ItemProperty $DataCollection AllowTelemetry -Value 1 #Re-enables People Icon on Taskbar - Write-Output "Enabling People icon on Taskbar" + Write-Host "Enabling People icon on Taskbar" $People = "HKCU:\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\Advanced\People" If (!(Test-Path $People)) { New-Item $People @@ -778,7 +791,7 @@ $RevertChange.Add_Click( { Set-ItemProperty $People PeopleBand -Value 1 #Re-enables suggestions on start menu - Write-Output "Enabling suggestions on the Start Menu" + Write-Host "Enabling suggestions on the Start Menu" $Suggestions = "HKCU:\Software\Microsoft\Windows\CurrentVersion\ContentDeliveryManager" If (!(Test-Path $Suggestions)) { New-Item $Suggestions @@ -786,7 +799,7 @@ $RevertChange.Add_Click( { Set-ItemProperty $Suggestions SystemPaneSuggestionsEnabled -Value 1 #Re-enables scheduled tasks that were disabled when running the Debloat switch - Write-Output "Enabling scheduled tasks that were disabled" + Write-Host "Enabling scheduled tasks that were disabled" Get-ScheduledTask XblGameSaveTaskLogon | Enable-ScheduledTask Get-ScheduledTask XblGameSaveTask | Enable-ScheduledTask Get-ScheduledTask Consolidator | Enable-ScheduledTask @@ -794,15 +807,16 @@ $RevertChange.Add_Click( { Get-ScheduledTask DmClient | Enable-ScheduledTask Get-ScheduledTask DmClientOnScenarioDownload | Enable-ScheduledTask - Write-Output "Re-enabling and starting WAP Push Service" + Write-Host "Re-enabling and starting WAP Push Service" #Enable and start WAP Push Service Set-Service "dmwappushservice" -StartupType Automatic Start-Service "dmwappushservice" - Write-Output "Re-enabling and starting the Diagnostics Tracking Service" + Write-Host "Re-enabling and starting the Diagnostics Tracking Service" #Enabling the Diagnostics Tracking Service Set-Service "DiagTrack" -StartupType Automatic Start-Service "DiagTrack" + Write-Host "Done reverting changes! `n" }) $FixWhitelist.Add_Click( { $ErrorActionPreference = 'silentlycontinue' @@ -814,6 +828,8 @@ $FixWhitelist.Add_Click( { Get-AppxPackage -allusers Microsoft.WindowsStore | Foreach {Add-AppxPackage -DisableDevelopmentMode -Register "$($_.InstallLocation)\AppXManifest.xml"} Get-AppxPackage -allusers Microsoft.Windows.Photos | Foreach {Add-AppxPackage -DisableDevelopmentMode -Register "$($_.InstallLocation)\AppXManifest.xml"} } + + Write-Host "Whitelisted apps were either fixed or re-added. `n" }) $DisableCortana.Add_Click( { $ErrorActionPreference = 'silentlycontinue' @@ -834,10 +850,12 @@ $DisableCortana.Add_Click( { New-Item $Cortana3 } Set-ItemProperty $Cortana3 HarvestContacts -Value 0 + Write-Host "Cortana has been disabled. `n" }) $StopEdgePDFTakeover.Add_Click( { + $ErrorActionPreference = 'silentlycontinue' #Stops edge from taking over as the default .PDF viewer - Write-Output "Stopping Edge from taking over as the default .PDF viewer" + Write-Host "Stopping Edge from taking over as the default .PDF viewer" $NoPDF = "HKCR:\.pdf" $NoProgids = "HKCR:\.pdf\OpenWithProgids" $NoWithList = "HKCR:\.pdf\OpenWithList" @@ -865,6 +883,7 @@ $StopEdgePDFTakeover.Add_Click( { If (Test-Path $Edge) { Set-Item $Edge AppXd4nrz8ff68srnhf9t5a8sbjyar1cr723_ } + Write-Host "Edge should no longer take over as the default .PDF. `n" }) $EnableCortana.Add_Click( { $ErrorActionPreference = 'silentlycontinue' @@ -885,11 +904,12 @@ $EnableCortana.Add_Click( { New-Item $Cortana3 } Set-ItemProperty $Cortana3 HarvestContacts -Value 1 + Write-Host "Cortana has been enabled! `n" }) $EnableEdgePDFTakeover.Add_Click( { New-PSDrive HKCR -PSProvider Registry -Root HKEY_CLASSES_ROOT $ErrorActionPreference = 'silentlycontinue' - Write-Output "Setting Edge back to default" + Write-Host "Setting Edge back to default" $NoPDF = "HKCR:\.pdf" $NoProgids = "HKCR:\.pdf\OpenWithProgids" $NoWithList = "HKCR:\.pdf\OpenWithList" @@ -918,25 +938,26 @@ $EnableEdgePDFTakeover.Add_Click( { If (Test-Path $Edge2) { Set-Item $Edge2 AppXd4nrz8ff68srnhf9t5a8sbjyar1cr723 } + Write-Host "Edge will now be able to be used for .PDF. `n" }) $DisableTelemetry.Add_Click( { $ErrorActionPreference = 'silentlycontinue' #Disables Windows Feedback Experience - Write-Output "Disabling Windows Feedback Experience program" + Write-Host "Disabling Windows Feedback Experience program" $Advertising = "HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\AdvertisingInfo" If (Test-Path $Advertising) { Set-ItemProperty $Advertising Enabled -Value 0 } #Stops Cortana from being used as part of your Windows Search Function - Write-Output "Stopping Cortana from being used as part of your Windows Search Function" + Write-Host "Stopping Cortana from being used as part of your Windows Search Function" $Search = "HKLM:\SOFTWARE\Policies\Microsoft\Windows\Windows Search" If (Test-Path $Search) { Set-ItemProperty $Search AllowCortana -Value 0 } #Disables Web Search in Start Menu - Write-Output "Disabling Bing Search in Start Menu" + Write-Host "Disabling Bing Search in Start Menu" $WebSearch = "HKLM:\SOFTWARE\Policies\Microsoft\Windows\Windows Search" Set-ItemProperty "HKCU:\SOFTWARE\Microsoft\Windows\CurrentVersion\Search" BingSearchEnabled -Value 0 If (!(Test-Path $WebSearch)) { @@ -945,7 +966,7 @@ $DisableTelemetry.Add_Click( { Set-ItemProperty $WebSearch DisableWebSearch -Value 1 #Stops the Windows Feedback Experience from sending anonymous data - Write-Output "Stopping the Windows Feedback Experience program" + Write-Host "Stopping the Windows Feedback Experience program" $Period = "HKCU:\Software\Microsoft\Siuf\Rules" If (!(Test-Path $Period)) { New-Item $Period @@ -953,7 +974,7 @@ $DisableTelemetry.Add_Click( { Set-ItemProperty $Period PeriodInNanoSeconds -Value 0 #Prevents bloatware applications from returning and removes Start Menu suggestions - Write-Output "Adding Registry key to prevent bloatware apps from returning" + Write-Host "Adding Registry key to prevent bloatware apps from returning" $registryPath = "HKLM:\SOFTWARE\Policies\Microsoft\Windows\CloudContent" $registryOEM = "HKCU:\SOFTWARE\Microsoft\Windows\CurrentVersion\ContentDeliveryManager" If (!(Test-Path $registryPath)) { @@ -972,14 +993,14 @@ $DisableTelemetry.Add_Click( { Set-ItemProperty $registryOEM SystemPaneSuggestionsEnabled -Value 0 #Preping mixed Reality Portal for removal - Write-Output "Setting Mixed Reality Portal value to 0 so that you can uninstall it in Settings" + Write-Host "Setting Mixed Reality Portal value to 0 so that you can uninstall it in Settings" $Holo = "HKCU:\Software\Microsoft\Windows\CurrentVersion\Holographic" If (Test-Path $Holo) { Set-ItemProperty $Holo FirstRunSucceeded -Value 0 } #Disables Wi-fi Sense - Write-Output "Disabling Wi-Fi Sense" + Write-Host "Disabling Wi-Fi Sense" $WifiSense1 = "HKLM:\SOFTWARE\Microsoft\PolicyManager\default\WiFi\AllowWiFiHotSpotReporting" $WifiSense2 = "HKLM:\SOFTWARE\Microsoft\PolicyManager\default\WiFi\AllowAutoConnectToWiFiSenseHotspots" $WifiSense3 = "HKLM:\SOFTWARE\Microsoft\WcmSvc\wifinetworkmanager\config" @@ -994,7 +1015,7 @@ $DisableTelemetry.Add_Click( { Set-ItemProperty $WifiSense3 AutoConnectAllowedOEM -Value 0 #Disables live tiles - Write-Output "Disabling live tiles" + Write-Host "Disabling live tiles" $Live = "HKCU:\SOFTWARE\Policies\Microsoft\Windows\CurrentVersion\PushNotifications" If (!(Test-Path $Live)) { New-Item $Live @@ -1002,7 +1023,7 @@ $DisableTelemetry.Add_Click( { Set-ItemProperty $Live NoTileApplicationNotification -Value 1 #Turns off Data Collection via the AllowTelemtry key by changing it to 0 - Write-Output "Turning off Data Collection" + Write-Host "Turning off Data Collection" $DataCollection1 = "HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\Policies\DataCollection" $DataCollection2 = "HKLM:\SOFTWARE\Policies\Microsoft\Windows\DataCollection" $DataCollection3 = "HKLM:\SOFTWARE\Wow6432Node\Microsoft\Windows\CurrentVersion\Policies\DataCollection" @@ -1017,7 +1038,7 @@ $DisableTelemetry.Add_Click( { } #Disabling Location Tracking - Write-Output "Disabling Location Tracking" + Write-Host "Disabling Location Tracking" $SensorState = "HKLM:\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Sensor\Overrides\{BFA794E4-F964-4FDB-90F6-51056BFE4B44}" $LocationConfig = "HKLM:\SYSTEM\CurrentControlSet\Services\lfsvc\Service\Configuration" If (!(Test-Path $SensorState)) { @@ -1030,7 +1051,7 @@ $DisableTelemetry.Add_Click( { Set-ItemProperty $LocationConfig Status -Value 0 #Disables People icon on Taskbar - Write-Output "Disabling People icon on Taskbar" + Write-Host "Disabling People icon on Taskbar" $People = "HKCU:\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\Advanced\People" If (!(Test-Path $People)) { New-Item $People @@ -1038,7 +1059,7 @@ $DisableTelemetry.Add_Click( { Set-ItemProperty $People PeopleBand -Value 0 #Disables scheduled tasks that are considered unnecessary - Write-Output "Disabling scheduled tasks" + Write-Host "Disabling scheduled tasks" Get-ScheduledTask XblGameSaveTaskLogon | Disable-ScheduledTask Get-ScheduledTask XblGameSaveTask | Disable-ScheduledTask Get-ScheduledTask Consolidator | Disable-ScheduledTask @@ -1046,15 +1067,23 @@ $DisableTelemetry.Add_Click( { Get-ScheduledTask DmClient | Disable-ScheduledTask Get-ScheduledTask DmClientOnScenarioDownload | Disable-ScheduledTask - Write-Output "Stopping and disabling WAP Push Service" + #Write-Host "Uninstalling Telemetry Windows Updates" + #Uninstalls Some Windows Updates considered to be Telemetry. !WIP! + #Wusa /Uninstall /KB:3022345 /norestart /quiet + #Wusa /Uninstall /KB:3068708 /norestart /quiet + #Wusa /Uninstall /KB:3075249 /norestart /quiet + #Wusa /Uninstall /KB:3080149 /norestart /quiet + + Write-Host "Stopping and disabling WAP Push Service" #Stop and disable WAP Push Service Stop-Service "dmwappushservice" Set-Service "dmwappushservice" -StartupType Disabled - Write-Output "Stopping and disabling Diagnostics Tracking Service" + Write-Host "Stopping and disabling Diagnostics Tracking Service" #Disabling the Diagnostics Tracking Service Stop-Service "DiagTrack" Set-Service "DiagTrack" -StartupType Disabled + Write-Host "Telemetry has been disabled! `n" }) $RemoveRegkeys.Add_Click( { $ErrorActionPreference = 'silentlycontinue' @@ -1094,12 +1123,13 @@ $RemoveRegkeys.Add_Click( { #This writes the output of each key it is removing and also removes the keys listed above. ForEach ($Key in $Keys) { - Write-Output "Removing $Key from registry" + Write-Host "Removing $Key from registry" Remove-Item $Key -Recurse } + Write-Host "Additional bloatware keys have been removed! `n" }) $RemoveOnedrive.Add_Click( { - Write-Output "Uninstalling OneDrive" + Write-Host "Uninstalling OneDrive. Please wait..." New-PSDrive HKCR -PSProvider Registry -Root HKEY_CLASSES_ROOT $onedrive = "$env:SYSTEMROOT\SysWOW64\OneDriveSetup.exe" @@ -1112,18 +1142,18 @@ $RemoveOnedrive.Add_Click( { } Start-Process $onedrive "/uninstall" -NoNewWindow -Wait Start-Sleep 2 - Write-Output "Stopping explorer" + Write-Host "Stopping explorer" Start-Sleep 1 .\taskkill.exe /F /IM explorer.exe Start-Sleep 3 - Write-Output "Removing leftover files" + Write-Host "Removing leftover files" Remove-Item "$env:USERPROFILE\OneDrive" -Force -Recurse Remove-Item "$env:LOCALAPPDATA\Microsoft\OneDrive" -Force -Recurse Remove-Item "$env:PROGRAMDATA\Microsoft OneDrive" -Force -Recurse If (Test-Path "$env:SYSTEMDRIVE\OneDriveTemp") { Remove-Item "$env:SYSTEMDRIVE\OneDriveTemp" -Force -Recurse } - Write-Output "Removing OneDrive from windows explorer" + Write-Host "Removing OneDrive from windows explorer" If (!(Test-Path $ExplorerReg1)) { New-Item $ExplorerReg1 } @@ -1132,8 +1162,9 @@ $RemoveOnedrive.Add_Click( { New-Item $ExplorerReg2 } Set-ItemProperty $ExplorerReg2 System.IsPinnedToNameSpaceTree -Value 0 - Write-Output "Restarting Explorer that was shut down before." + Write-Host "Restarting Explorer that was shut down before." Start-Process explorer.exe -NoNewWindow + Write-Host "OneDrive has been successfully uninstalled! `n" }) #endregion events } From 55131f2c21cb4ee66a73066a15d7abc393b4ed45 Mon Sep 17 00:00:00 2001 From: Richard Newton Date: Sat, 19 Jan 2019 20:45:27 -0800 Subject: [PATCH 05/15] Added function to delete windowsapps --- Windows10Debloater.ps1 | 166 ++++++++++++++++++++++++++++++++++------- 1 file changed, 137 insertions(+), 29 deletions(-) diff --git a/Windows10Debloater.ps1 b/Windows10Debloater.ps1 index 4cf0f397..7bd0d32f 100644 --- a/Windows10Debloater.ps1 +++ b/Windows10Debloater.ps1 @@ -4,17 +4,18 @@ #no errors throughout $ErrorActionPreference = 'silentlycontinue' -If (Test-Path "C:\Windows10Debloater") { - Write-Output "C:\Windows10Debloater exists. Skipping." +$DebloatFolder = "C:\Temp\Windows10Debloater" +If (Test-Path $DebloatFolder) { + Write-Output "$DebloatFolder exists. Skipping." } Else { - Write-Output "The folder 'C:\Windows10Debloater' doesn't exist. This folder will be used for storing logs created after the script runs. Creating now." + Write-Output "The folder "$DebloatFolder" doesn't exist. This folder will be used for storing logs created after the script runs. Creating now." Start-Sleep 1 - New-Item -Path "C:\Windows10Debloater" -ItemType Directory - Write-Output "The folder C:\Windows10Debloater was successfully created." + New-Item -Path "$DebloatFolder" -ItemType Directory + Write-Output "The folder $DebloatFolder was successfully created." } -Start-Transcript -OutputDirectory "C:\Windows10Debloater" +Start-Transcript -OutputDirectory "$DebloatFolder" Add-Type -AssemblyName PresentationCore, PresentationFramework @@ -26,7 +27,7 @@ Function DebloatAll { #Removes AppxPackages #Credit to /u/GavinEke for a modified version of my whitelist code - [regex]$WhitelistedApps = 'Microsoft.ScreenSketch|Microsoft.Paint3D|Microsoft.WindowsCalculator|Microsoft.WindowsStore|Microsoft.Windows.Photos|CanonicalGroupLimited.UbuntuonWindows|Microsoft.XboxGameCallableUI|Microsoft.XboxGamingOverlay|Microsoft.Xbox.TCUI|Microsoft.XboxGamingOverlay|Microsoft.XboxIdentityProvider|Microsoft.MicrosoftStickyNotes|Microsoft.MSPaint' + [regex]$WhitelistedApps = 'Microsoft.ScreenSketch|Microsoft.Paint3D|Microsoft.WindowsCalculator|Microsoft.WindowsStore|Microsoft.Windows.Photos|CanonicalGroupLimited.UbuntuonWindows|Microsoft.XboxGameCallableUI|Microsoft.XboxGamingOverlay|Microsoft.Xbox.TCUI|Microsoft.XboxGamingOverlay|Microsoft.XboxIdentityProvider|Microsoft.MicrosoftStickyNotes|Microsoft.MSPaint|Microsoft.WindowsCamera|.NET' Get-AppxPackage -AllUsers | Where-Object {$_.Name -NotMatch $WhitelistedApps} | Remove-AppxPackage Get-AppxPackage | Where-Object {$_.Name -NotMatch $WhitelistedApps} | Remove-AppxPackage Get-AppxProvisionedPackage -Online | Where-Object {$_.PackageName -NotMatch $WhitelistedApps} | Remove-AppxProvisionedPackage -Online @@ -58,7 +59,7 @@ Function DebloatBlacklist { "Microsoft.SkypeApp" "Microsoft.StorePurchaseApp" "Microsoft.WindowsAlarms" - "Microsoft.WindowsCamera" + #"Microsoft.WindowsCamera" "microsoft.windowscommunicationsapps" "Microsoft.WindowsFeedbackHub" "Microsoft.WindowsMaps" @@ -99,7 +100,7 @@ Function DebloatBlacklist { ) foreach ($Bloat in $Bloatware) { Get-AppxPackage -Name $Bloat| Remove-AppxPackage -ErrorAction SilentlyContinue - Get-AppxProvisionedPackage -Online | Where-Object DisplayName -like $Debloat | Remove-AppxProvisionedPackage -Online -ErrorAction SilentlyContinue + Get-AppxProvisionedPackage -Online | Where-Object DisplayName -like $Bloat | Remove-AppxProvisionedPackage -Online -ErrorAction SilentlyContinue Write-Output "Trying to remove $Bloat." } } @@ -283,15 +284,19 @@ Function Protect-Privacy { Get-ScheduledTask DmClient | Disable-ScheduledTask Get-ScheduledTask DmClientOnScenarioDownload | Disable-ScheduledTask - Write-Output "Stopping and disabling WAP Push Service" - #Stop and disable WAP Push Service - Stop-Service "dmwappushservice" - Set-Service "dmwappushservice" -StartupType Disabled - Write-Output "Stopping and disabling Diagnostics Tracking Service" #Disabling the Diagnostics Tracking Service Stop-Service "DiagTrack" Set-Service "DiagTrack" -StartupType Disabled + + + Write-Output "Removing CloudStore from registry if it exists" + $CloudStore = 'HKCUSoftware\Microsoft\Windows\CurrentVersion\CloudStore' + If (Test-Path $CloudStore) { + Stop-Process Explorer.exe -Force + Remove-Item $CloudStore + Start-Process Explorer.exe -Wait + } } Function DisableCortana { @@ -467,6 +472,17 @@ Function Revert-Changes { Set-Service "DiagTrack" -StartupType Automatic Start-Service "DiagTrack" } + +Function CheckDMWService { + + Param([switch]$Debloat) + +If (Get-Service -Name dmwappushservice | Where-Object {$_.StartType -eq "Disabled"}) { + Set-Service -Name dmwappushservice -StartupType Automatic} + +If(Get-Service -Name dmwappushservice | Where-Object {$_.Status -eq "Stopped"}) { + Start-Service -Name dmwappushservice} + } Function Enable-EdgePDF { Write-Output "Setting Edge back to default" @@ -518,6 +534,36 @@ Function FixWhitelistedApps { Function UninstallOneDrive { + Write-Output "Checking for pre-existing files and folders located in the OneDrive folders..." + Start-Sleep 1 + If (Get-Item -Path "$env:USERPROFILE\OneDrive\*") { + Write-Output "Files found within the OneDrive folder! Checking to see if a folder named OneDriveBackupFiles exists." + Start-Sleep 1 + + If (Get-Item "$env:USERPROFILE\Desktop\OneDriveBackupFiles" -ErrorAction SilentlyContinue) { + Write-Output "A folder named OneDriveBackupFiles already exists on your desktop. All files from your OneDrive location will be moved to that folder." + } + else { + If (!(Get-Item "$env:USERPROFILE\Desktop\OneDriveBackupFiles" -ErrorAction SilentlyContinue)) { + Write-Output "A folder named OneDriveBackupFiles will be created and will be located on your desktop. All files from your OneDrive location will be located in that folder." + New-item -Path "$env:USERPROFILE\Desktop" -Name "OneDriveBackupFiles"-ItemType Directory -Force + Write-Output "Successfully created the folder 'OneDriveBackupFiles' on your desktop." + } + } + Start-Sleep 1 + Move-Item -Path "$env:USERPROFILE\OneDrive\*" -Destination "$env:USERPROFILE\Desktop\OneDriveBackupFiles" -Force + Write-Output "Successfully moved all files/folders from your OneDrive folder to the folder 'OneDriveBackupFiles' on your desktop." + Start-Sleep 1 + Write-Output "Proceeding with the removal of OneDrive." + Start-Sleep 1 + } + Else { + If (!(Get-Item -Path "$env:USERPROFILE\OneDrive\*")) { + Write-Output "Either the OneDrive folder does not exist or there are no files to be found in the folder. Proceeding with removal of OneDrive." + Start-Sleep 1 + } + } + Write-Output "Uninstalling OneDrive" New-PSDrive HKCR -PSProvider Registry -Root HKEY_CLASSES_ROOT @@ -553,6 +599,17 @@ Function UninstallOneDrive { Set-ItemProperty $ExplorerReg2 System.IsPinnedToNameSpaceTree -Value 0 Write-Output "Restarting Explorer that was shut down before." Start-Process explorer.exe -NoNewWindow + + Write-Host "Enabling the Group Policy 'Prevent the usage of OneDrive for File Storage'." + $OneDriveKey = 'HKLM:Software\Policies\Microsoft\Windows\OneDrive' + If (!(Test-Path $OneDriveKey)) { + Mkdir $OneDriveKey + } + + $DisableAllOneDrive = 'HKLM:Software\Policies\Microsoft\Windows\OneDrive' + If (Test-Path $DisableAllOneDrive) { + New-ItemProperty $DisableAllOneDrive -Name OneDrive -Value DisableFileSyncNGSC -Verbose + } } #GUI prompt Debloat/Revert options and GUI variables @@ -610,8 +667,9 @@ Switch ($Prompt1) { Write-Output "Disabling WAP push service" Start-Sleep 1 DisableWAPPush - Write-Output "WAP push service stopped and disabled" - Start-Sleep 1; = $Debloat + Write-Output "Re-enabling DMWAppushservice if it was disabled" + CheckDMWService + Start-Sleep 1 } No { #Creates a "drive" to access the HKCR (HKEY_CLASSES_ROOT) @@ -643,8 +701,9 @@ Switch ($Prompt1) { Write-Output "Disabling WAP push service" Start-Sleep 1 DisableWAPPush - Write-Output "WAP push service stopped and disabled" - Start-Sleep 1; = $Debloat + Write-Output "Re-enabling DMWAppushservice if it was disabled" + CheckDMWService + Start-Sleep 1 } } @@ -652,10 +711,10 @@ Switch ($Prompt1) { Switch ($Prompt3) { Yes { Stop-EdgePDF - Write-Output "Edge will no longer take over as the default PDF viewer."; = $Yes + Write-Output "Edge will no longer take over as the default PDF viewer." } No { - = $No + Write-Output "You chose not to stop Edge from taking over as the default PDF viewer." } } #Prompt asking to delete OneDrive @@ -663,10 +722,10 @@ Switch ($Prompt1) { Switch ($Prompt4) { Yes { UninstallOneDrive - Write-Output "OneDrive is now removed from the computer."; = $Yes + Write-Output "OneDrive is now removed from the computer." } No { - = $No + Write-Output "You have chosen to skip removing OneDrive from your machine." } } #Prompt asking if you'd like to reboot your machine @@ -679,7 +738,7 @@ Switch ($Prompt1) { Stop-Transcript Write-Output "Initiating reboot." Start-Sleep 2 - Restart-Computer; = $Yes + Restart-Computer } No { Write-Output "Unloading the HKCR drive..." @@ -688,7 +747,7 @@ Switch ($Prompt1) { Stop-Transcript Write-Output "Script has finished. Exiting." Start-Sleep 2 - Exit; = $No + Exit } } } @@ -696,16 +755,16 @@ Switch ($Prompt1) { Write-Output "Reverting changes..." Write-Output "Creating PSDrive 'HKCR' (HKEY_CLASSES_ROOT). This will be used for the duration of the script as it is necessary for the modification of specific registry keys." New-PSDrive HKCR -PSProvider Registry -Root HKEY_CLASSES_ROOT - Revert-Changes; = $Revert + Revert-Changes #Prompt asking to revert edge changes as well $Prompt6 = [Windows.MessageBox]::Show($EdgePdf2, "Revert Edge", $Button, $ErrorIco) Switch ($Prompt6) { Yes { Enable-EdgePDF - Write-Output "Edge will no longer be disabled from being used as the default Edge PDF viewer."; = $Yes + Write-Output "Edge will no longer be disabled from being used as the default Edge PDF viewer." } No { - = $No + Write-Output "You have chosen to keep the setting that disallows Edge to be the default PDF viewer." } } #Prompt asking if you'd like to reboot your machine @@ -718,7 +777,7 @@ Switch ($Prompt1) { Write-Output "Initiating reboot." Stop-Transcript Start-Sleep 2 - Restart-Computer; = $Yes + Restart-Computer } No { Write-Output "Unloading the HKCR drive..." @@ -727,8 +786,57 @@ Switch ($Prompt1) { Write-Output "Script has finished. Exiting." Stop-Transcript Start-Sleep 2 - Exit; = $No + Exit } } } } + + +#Function that is in testing. Can't figure out why I cannot delete the C:\Program Files\WindowsApps path + +Function DeleteBloatwareSystemFolders { + Write-Output "This will delete the folders located at: + + C:\Windows\SystemApps and C:\Program Files\WindowsApps. This will prevent the bloatware from coming back by removing the included .xml files as well as` + any other files within the folders associated with the bloatware apps." + + $Windowsapps = @( + "*Microsoft.BingWeather*" + "*Microsoft.GetHelp*" + "*Microsoft.Getstarted*" + "*Microsoft.Microsoft3DViewer*" + "*Microsoft.MicrosoftOfficeHub*" + "*Microsoft.MicrosoftSolitaireCollection*" + "*Microsoft.MixedReality.Portal*" + #"*Microsoft.Office.OneNote*" + "*Microsoft.OneConnect*" + "*Microsoft.People*" + "*Microsoft.Print3D*" + "*Microsoft.ScreenSketch*" + "*Microsoft.SkypeApp*" + "*Microsoft.WindowsAlarms*" + "*microsoft.windowscommunicationsapps*" + "*Microsoft.WindowsFeedbackHub*" + "*Microsoft.WindowsMaps*" + "*Microsoft.WindowsSoundRecorder*" + #"*Microsoft.WindowsStore*" + "*Microsoft.Xbox*" + "*Microsoft.YourPhone*" + "*Microsoft.ZuneMusic*" + ) + Start-process Powershell Get-Credential "" + + foreach ($app in $Windowsapps) { + Remove-Item -Recurse "C:\Program Files\WindowsApps\$app" -force + Write-Output "Trying to remove $app." + } + + #This works to take ownership of the path. But I think PS is running as system and not myself. + #takeown.exe /f 'C:\Program Files\WindowsApps' + +} + +Start-Process powershell.exe -Credential "domain\username" -NoNewWindow -ArgumentList "Start-Process powershell.exe -Verb runAs" + + From 689de3bd01de611530e447772ad1788c27ebd0f9 Mon Sep 17 00:00:00 2001 From: Richard Newton Date: Sat, 20 Apr 2019 23:25:13 -0700 Subject: [PATCH 06/15] Updated Windows10DebloaterGUI.ps1 --- Windows10DebloaterGUI.ps1 | 1334 +++++-------------------------------- 1 file changed, 162 insertions(+), 1172 deletions(-) diff --git a/Windows10DebloaterGUI.ps1 b/Windows10DebloaterGUI.ps1 index 9cf84559..76081587 100644 --- a/Windows10DebloaterGUI.ps1 +++ b/Windows10DebloaterGUI.ps1 @@ -1,1173 +1,163 @@ Add-Type -AssemblyName System.Windows.Forms -[System.Windows.Forms.Application]::EnableVisualStyles() - -#region begin GUI{ - -$Form = New-Object system.Windows.Forms.Form -$Form.ClientSize = '408,523' -$Form.text = "Windows10Debloater" -$Form.TopMost = $false - -$Debloat = New-Object system.Windows.Forms.Label -$Debloat.text = "Debloat Options" -$Debloat.AutoSize = $true -$Debloat.width = 25 -$Debloat.height = 10 -$Debloat.location = New-Object System.Drawing.Point(9, 8) -$Debloat.Font = 'Microsoft Sans Serif,12,style=Bold,Underline' - -$RemoveAllBloatware = New-Object system.Windows.Forms.Button -$RemoveAllBloatware.text = "Remove All Bloatware" -$RemoveAllBloatware.width = 142 -$RemoveAllBloatware.height = 40 -$RemoveAllBloatware.location = New-Object System.Drawing.Point(8, 32) -$RemoveAllBloatware.Font = 'Microsoft Sans Serif,10' - -$RemoveBlacklist = New-Object system.Windows.Forms.Button -$RemoveBlacklist.text = "Remove Bloatware With Blacklist" -$RemoveBlacklist.width = 205 -$RemoveBlacklist.height = 37 -$RemoveBlacklist.location = New-Object System.Drawing.Point(9, 79) -$RemoveBlacklist.Font = 'Microsoft Sans Serif,10' - -$Label1 = New-Object system.Windows.Forms.Label -$Label1.text = "Revert Debloat " -$Label1.AutoSize = $true -$Label1.width = 25 -$Label1.height = 10 -$Label1.location = New-Object System.Drawing.Point(254, 7) -$Label1.Font = 'Microsoft Sans Serif,12,style=Bold,Underline' - -$RevertChange = New-Object system.Windows.Forms.Button -$RevertChange.text = "Revert Changes" -$RevertChange.width = 113 -$RevertChange.height = 36 -$RevertChange.location = New-Object System.Drawing.Point(254, 32) -$RevertChange.Font = 'Microsoft Sans Serif,10' - -$Label2 = New-Object system.Windows.Forms.Label -$Label2.text = "Optional Privacy Changes/Fixes" -$Label2.AutoSize = $true -$Label2.width = 25 -$Label2.height = 10 -$Label2.location = New-Object System.Drawing.Point(9, 193) -$Label2.Font = 'Microsoft Sans Serif,12,style=Bold,Underline' - -$DisableCortana = New-Object system.Windows.Forms.Button -$DisableCortana.text = "Disable Cortana" -$DisableCortana.width = 111 -$DisableCortana.height = 36 -$DisableCortana.location = New-Object System.Drawing.Point(9, 217) -$DisableCortana.Font = 'Microsoft Sans Serif,10' - -$EnableCortana = New-Object system.Windows.Forms.Button -$EnableCortana.text = "Enable Cortana" -$EnableCortana.width = 112 -$EnableCortana.height = 36 -$EnableCortana.location = New-Object System.Drawing.Point(9, 260) -$EnableCortana.Font = 'Microsoft Sans Serif,10' - -$StopEdgePDFTakeover = New-Object system.Windows.Forms.Button -$StopEdgePDFTakeover.text = "Stop Edge PDF Takeover" -$StopEdgePDFTakeover.width = 161 -$StopEdgePDFTakeover.height = 38 -$StopEdgePDFTakeover.location = New-Object System.Drawing.Point(130, 217) -$StopEdgePDFTakeover.Font = 'Microsoft Sans Serif,10' - -$EnableEdgePDFTakeover = New-Object system.Windows.Forms.Button -$EnableEdgePDFTakeover.text = "Enable Edge PDF Takeover" -$EnableEdgePDFTakeover.width = 177 -$EnableEdgePDFTakeover.height = 39 -$EnableEdgePDFTakeover.location = New-Object System.Drawing.Point(130, 260) -$EnableEdgePDFTakeover.Font = 'Microsoft Sans Serif,10' - -$DisableTelemetry = New-Object system.Windows.Forms.Button -$DisableTelemetry.text = "Disable Telemetry/Tasks" -$DisableTelemetry.width = 152 -$DisableTelemetry.height = 35 -$DisableTelemetry.location = New-Object System.Drawing.Point(9, 303) -$DisableTelemetry.Font = 'Microsoft Sans Serif,10' - -$RemoveRegkeys = New-Object system.Windows.Forms.Button -$RemoveRegkeys.text = "Remove Bloatware Regkeys" -$RemoveRegkeys.width = 177 -$RemoveRegkeys.height = 40 -$RemoveRegkeys.location = New-Object System.Drawing.Point(169, 303) -$RemoveRegkeys.Font = 'Microsoft Sans Serif,10' - -$RemoveOnedrive = New-Object system.Windows.Forms.Button -$RemoveOnedrive.text = "Uninstall OneDrive" -$RemoveOnedrive.width = 117 -$RemoveOnedrive.height = 35 -$RemoveOnedrive.location = New-Object System.Drawing.Point(9, 345) -$RemoveOnedrive.Font = 'Microsoft Sans Serif,10' - -$FixWhitelist = New-Object system.Windows.Forms.Button -$FixWhitelist.text = "Fix Whitelisted Apps" -$FixWhitelist.width = 130 -$FixWhitelist.height = 37 -$FixWhitelist.location = New-Object System.Drawing.Point(254, 74) -$FixWhitelist.Font = 'Microsoft Sans Serif,10' - -$RemoveBloatNoBlacklist = New-Object system.Windows.Forms.Button -$RemoveBloatNoBlacklist.text = "Remove Bloatware Without Blacklist" -$RemoveBloatNoBlacklist.width = 223 -$RemoveBloatNoBlacklist.height = 39 -$RemoveBloatNoBlacklist.location = New-Object System.Drawing.Point(9, 123) -$RemoveBloatNoBlacklist.Font = 'Microsoft Sans Serif,10' - -$Form.controls.AddRange(@($Debloat, $RemoveAllBloatware, $RemoveBlacklist, $Label1, $RevertChange, $Label2, $DisableCortana, $EnableCortana, $StopEdgePDFTakeover, $EnableEdgePDFTakeover, $DisableTelemetry, $RemoveRegkeys, $RemoveOnedrive, $FixWhitelist, $RemoveBloatNoBlacklist)) - -#region gui events { -$RemoveBlacklist.Add_Click( { - $ErrorActionPreference = 'silentlycontinue' - Function DebloatBlacklist { - [CmdletBinding()] - - Param () - - $Bloatware = @( - - #Unnecessary Windows 10 AppX Apps - "Microsoft.BingNews" - "Microsoft.DesktopAppInstaller" - "Microsoft.GetHelp" - "Microsoft.Getstarted" - "Microsoft.Messaging" - "Microsoft.Microsoft3DViewer" - "Microsoft.MicrosoftOfficeHub" - "Microsoft.MicrosoftSolitaireCollection" - "Microsoft.NetworkSpeedTest" - "Microsoft.Office.OneNote" - "Microsoft.Office.Sway" - "Microsoft.OneConnect" - "Microsoft.People" - "Microsoft.Print3D" - "Microsoft.RemoteDesktop" - "Microsoft.SkypeApp" - "Microsoft.StorePurchaseApp" - "Microsoft.WindowsAlarms" - "Microsoft.WindowsCamera" - "microsoft.windowscommunicationsapps" - "Microsoft.WindowsFeedbackHub" - "Microsoft.WindowsMaps" - "Microsoft.WindowsSoundRecorder" - "Microsoft.Xbox.TCUI" - "Microsoft.XboxApp" - "Microsoft.XboxGameOverlay" - "Microsoft.XboxIdentityProvider" - "Microsoft.XboxSpeechToTextOverlay" - "Microsoft.ZuneMusic" - "Microsoft.ZuneVideo" - - #Sponsored Windows 10 AppX Apps - #Add sponsored/featured apps to remove in the "*AppName*" format - "*EclipseManager*" - "*ActiproSoftwareLLC*" - "*AdobeSystemsIncorporated.AdobePhotoshopExpress*" - "*Duolingo-LearnLanguagesforFree*" - "*PandoraMediaInc*" - "*CandyCrush*" - "*Wunderlist*" - "*Flipboard*" - "*Twitter*" - "*Facebook*" - "*Spotify*" - "*Minecraft*" - "*Royal Revolt*" - - #Optional: Typically not removed but you can if you need to for some reason - #"*Microsoft.Advertising.Xaml_10.1712.5.0_x64__8wekyb3d8bbwe*" - #"*Microsoft.Advertising.Xaml_10.1712.5.0_x86__8wekyb3d8bbwe*" - #"*Microsoft.BingWeather*" - #"*Microsoft.MSPaint*" - #"*Microsoft.MicrosoftStickyNotes*" - #"*Microsoft.Windows.Photos*" - #"*Microsoft.WindowsCalculator*" - #"*Microsoft.WindowsStore*" - ) - foreach ($Bloat in $Bloatware) { - Get-AppxPackage -Name $Bloat| Remove-AppxPackage -ErrorAction SilentlyContinue - Get-AppxProvisionedPackage -Online | Where-Object DisplayName -like $Bloat | Remove-AppxProvisionedPackage -Online -ErrorAction SilentlyContinue - Write-Host "Trying to remove $Bloat." - Write-Host "Bloatware removed! `n" - } - } - Write-Host "Removing Bloatware with a specific blacklist." - DebloatBlacklist - }) -$RemoveAllBloatware.Add_Click( { - $ErrorActionPreference = 'silentlycontinue' - #This function finds any AppX/AppXProvisioned package and uninstalls it, except for Freshpaint, Windows Calculator, Windows Store, and Windows Photos. - #Also, to note - This does NOT remove essential system services/software/etc such as .NET framework installations, Cortana, Edge, etc. - - #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. - - Function Begin-SysPrep { - $ErrorActionPreference = 'silentlycontinue' - - Write-Host -Message ('Starting Sysprep Fixes') - - # Disable Windows Store Automatic Updates - Write-Host -Message "Adding Registry key to Disable Windows Store Automatic Updates" - $registryPath = "HKLM:\SOFTWARE\Policies\Microsoft\WindowsStore" - If (!(Test-Path $registryPath)) { - Mkdir $registryPath -ErrorAction SilentlyContinue - New-ItemProperty $registryPath -Name AutoDownload -Value 2 - } - Else { - Set-ItemProperty $registryPath -Name AutoDownload -Value 2 - } - #Stop WindowsStore Installer Service and set to Disabled - Write-Host -Message ('Stopping InstallService') - Stop-Service InstallService - Write-Host -Message ('Setting InstallService Startup to Disabled') - & Set-Service -Name InstallService -StartupType Disabled - } - - Function DebloatAll { - - [CmdletBinding()] - - Param() - - #Removes AppxPackages - #Credit to /u/GavinEke for a modified version of my whitelist code - [regex]$WhitelistedApps = 'Microsoft.ScreenSketch|Microsoft.ScreenSketch|Microsoft.Paint3D|Microsoft.WindowsCalculator|Microsoft.WindowsStore|Microsoft.Windows.Photos|CanonicalGroupLimited.UbuntuonWindows|Microsoft.XboxGameCallableUI|Microsoft.XboxGamingOverlay|Microsoft.Xbox.TCUI|Microsoft.XboxGamingOverlay|Microsoft.XboxIdentityProvider|Microsoft.MicrosoftStickyNotes|Microsoft.MSPaint' - Get-AppxPackage -AllUsers | Where-Object {$_.Name -NotMatch $WhitelistedApps} | Remove-AppxPackage - Get-AppxPackage | Where-Object {$_.Name -NotMatch $WhitelistedApps} | Remove-AppxPackage - Get-AppxProvisionedPackage -Online | Where-Object {$_.PackageName -NotMatch $WhitelistedApps} | Remove-AppxProvisionedPackage -Online - } - - #Creates a PSDrive to be able to access the 'HKCR' tree - New-PSDrive -Name HKCR -PSProvider Registry -Root HKEY_CLASSES_ROOT - Function DebloatBlacklist { - $ErrorActionPreference = 'silentlycontinue' - - $Bloatware = @( - - #Unnecessary Windows 10 AppX Apps - "Microsoft.BingNews" - "Microsoft.DesktopAppInstaller" - "Microsoft.GetHelp" - "Microsoft.Getstarted" - "Microsoft.Messaging" - "Microsoft.Microsoft3DViewer" - "Microsoft.MicrosoftOfficeHub" - "Microsoft.MicrosoftSolitaireCollection" - "Microsoft.NetworkSpeedTest" - "Microsoft.Office.OneNote" - "Microsoft.Office.Sway" - "Microsoft.OneConnect" - "Microsoft.People" - "Microsoft.Print3D" - "Microsoft.RemoteDesktop" - "Microsoft.SkypeApp" - "Microsoft.StorePurchaseApp" - "Microsoft.WindowsAlarms" - "Microsoft.WindowsCamera" - "microsoft.windowscommunicationsapps" - "Microsoft.WindowsFeedbackHub" - "Microsoft.WindowsMaps" - "Microsoft.WindowsSoundRecorder" - "Microsoft.Xbox.TCUI" - "Microsoft.XboxApp" - "Microsoft.XboxGameOverlay" - "Microsoft.XboxIdentityProvider" - "Microsoft.XboxSpeechToTextOverlay" - "Microsoft.ZuneMusic" - "Microsoft.ZuneVideo" - - #Sponsored Windows 10 AppX Apps - #Add sponsored/featured apps to remove in the "*AppName*" format - "*EclipseManager*" - "*ActiproSoftwareLLC*" - "*AdobeSystemsIncorporated.AdobePhotoshopExpress*" - "*Duolingo-LearnLanguagesforFree*" - "*PandoraMediaInc*" - "*CandyCrush*" - "*Wunderlist*" - "*Flipboard*" - "*Twitter*" - "*Facebook*" - "*Spotify*" - "*Minecraft*" - "*Royal Revolt*" - - #Optional: Typically not removed but you can if you need to for some reason - #"*Microsoft.Advertising.Xaml_10.1712.5.0_x64__8wekyb3d8bbwe*" - #"*Microsoft.Advertising.Xaml_10.1712.5.0_x86__8wekyb3d8bbwe*" - #"*Microsoft.BingWeather*" - #"*Microsoft.MSPaint*" - #"*Microsoft.MicrosoftStickyNotes*" - #"*Microsoft.Windows.Photos*" - #"*Microsoft.WindowsCalculator*" - #"*Microsoft.WindowsStore*" - ) - foreach ($Bloat in $Bloatware) { - Get-AppxPackage -Name $Bloat| Remove-AppxPackage -ErrorAction SilentlyContinue - Get-AppxProvisionedPackage -Online | Where-Object DisplayName -like $Bloat | Remove-AppxProvisionedPackage -Online -ErrorAction SilentlyContinue - Write-Host "Trying to remove $Bloat." - } - } - - Function Remove-Keys { - $ErrorActionPreference = 'silentlycontinue' - - #These are the registry keys that it will delete. - - $Keys = @( - - #Remove Background Tasks - "HKCR:\Extensions\ContractId\Windows.BackgroundTasks\PackageId\46928bounde.EclipseManager_2.2.4.51_neutral__a5h4egax66k6y" - "HKCR:\Extensions\ContractId\Windows.BackgroundTasks\PackageId\ActiproSoftwareLLC.562882FEEB491_2.6.18.18_neutral__24pqs290vpjk0" - "HKCR:\Extensions\ContractId\Windows.BackgroundTasks\PackageId\Microsoft.MicrosoftOfficeHub_17.7909.7600.0_x64__8wekyb3d8bbwe" - "HKCR:\Extensions\ContractId\Windows.BackgroundTasks\PackageId\Microsoft.PPIProjection_10.0.15063.0_neutral_neutral_cw5n1h2txyewy" - "HKCR:\Extensions\ContractId\Windows.BackgroundTasks\PackageId\Microsoft.XboxGameCallableUI_1000.15063.0.0_neutral_neutral_cw5n1h2txyewy" - "HKCR:\Extensions\ContractId\Windows.BackgroundTasks\PackageId\Microsoft.XboxGameCallableUI_1000.16299.15.0_neutral_neutral_cw5n1h2txyewy" - - #Windows File - "HKCR:\Extensions\ContractId\Windows.File\PackageId\ActiproSoftwareLLC.562882FEEB491_2.6.18.18_neutral__24pqs290vpjk0" - - #Registry keys to delete if they aren't uninstalled by RemoveAppXPackage/RemoveAppXProvisionedPackage - "HKCR:\Extensions\ContractId\Windows.Launch\PackageId\46928bounde.EclipseManager_2.2.4.51_neutral__a5h4egax66k6y" - "HKCR:\Extensions\ContractId\Windows.Launch\PackageId\ActiproSoftwareLLC.562882FEEB491_2.6.18.18_neutral__24pqs290vpjk0" - "HKCR:\Extensions\ContractId\Windows.Launch\PackageId\Microsoft.PPIProjection_10.0.15063.0_neutral_neutral_cw5n1h2txyewy" - "HKCR:\Extensions\ContractId\Windows.Launch\PackageId\Microsoft.XboxGameCallableUI_1000.15063.0.0_neutral_neutral_cw5n1h2txyewy" - "HKCR:\Extensions\ContractId\Windows.Launch\PackageId\Microsoft.XboxGameCallableUI_1000.16299.15.0_neutral_neutral_cw5n1h2txyewy" - - #Scheduled Tasks to delete - "HKCR:\Extensions\ContractId\Windows.PreInstalledConfigTask\PackageId\Microsoft.MicrosoftOfficeHub_17.7909.7600.0_x64__8wekyb3d8bbwe" - - #Windows Protocol Keys - "HKCR:\Extensions\ContractId\Windows.Protocol\PackageId\ActiproSoftwareLLC.562882FEEB491_2.6.18.18_neutral__24pqs290vpjk0" - "HKCR:\Extensions\ContractId\Windows.Protocol\PackageId\Microsoft.PPIProjection_10.0.15063.0_neutral_neutral_cw5n1h2txyewy" - "HKCR:\Extensions\ContractId\Windows.Protocol\PackageId\Microsoft.XboxGameCallableUI_1000.15063.0.0_neutral_neutral_cw5n1h2txyewy" - "HKCR:\Extensions\ContractId\Windows.Protocol\PackageId\Microsoft.XboxGameCallableUI_1000.16299.15.0_neutral_neutral_cw5n1h2txyewy" - - #Windows Share Target - "HKCR:\Extensions\ContractId\Windows.ShareTarget\PackageId\ActiproSoftwareLLC.562882FEEB491_2.6.18.18_neutral__24pqs290vpjk0" - ) - - #This writes the output of each key it is removing and also removes the keys listed above. - ForEach ($Key in $Keys) { - Write-Host "Removing $Key from registry" - Remove-Item $Key -Recurse -ErrorAction SilentlyContinue - } - } - - Function Protect-Privacy { - $ErrorActionPreference = 'silentlycontinue' - - #Creates a PSDrive to be able to access the 'HKCR' tree - New-PSDrive -Name HKCR -PSProvider Registry -Root HKEY_CLASSES_ROOT - - #Disables Windows Feedback Experience - Write-Host "Disabling Windows Feedback Experience program" - $Advertising = 'HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\AdvertisingInfo' - If (Test-Path $Advertising) { - Set-ItemProperty $Advertising -Name Enabled -Value 0 -Verbose - } - - #Stops Cortana from being used as part of your Windows Search Function - Write-Host "Stopping Cortana from being used as part of your Windows Search Function" - $Search = 'HKLM:\SOFTWARE\Policies\Microsoft\Windows\Windows Search' - If (Test-Path $Search) { - Set-ItemProperty $Search -Name AllowCortana -Value 0 -Verbose - } - - #Stops the Windows Feedback Experience from sending anonymous data - Write-Host "Stopping the Windows Feedback Experience program" - $Period1 = 'HKCU:\Software\Microsoft\Siuf' - $Period2 = 'HKCU:\Software\Microsoft\Siuf\Rules' - $Period3 = 'HKCU:\Software\Microsoft\Siuf\Rules\PeriodInNanoSeconds' - If (!(Test-Path $Period3)) { - mkdir $Period1 -ErrorAction SilentlyContinue - mkdir $Period2 -ErrorAction SilentlyContinue - mkdir $Period3 -ErrorAction SilentlyContinue - New-ItemProperty $Period3 -Name PeriodInNanoSeconds -Value 0 -Verbose -ErrorAction SilentlyContinue - } - - Write-Host "Adding Registry key to prevent bloatware apps from returning" - #Prevents bloatware applications from returning - $registryPath = "HKLM:\SOFTWARE\Policies\Microsoft\Windows\CloudContent" - If (!(Test-Path $registryPath)) { - Mkdir $registryPath -ErrorAction SilentlyContinue - New-ItemProperty $registryPath -Name DisableWindowsConsumerFeatures -Value 1 -Verbose -ErrorAction SilentlyContinue - } - - Write-Host "Setting Mixed Reality Portal value to 0 so that you can uninstall it in Settings" - $Holo = 'HKCU:\Software\Microsoft\Windows\CurrentVersion\Holographic' - If (Test-Path $Holo) { - Set-ItemProperty $Holo -Name FirstRunSucceeded -Value 0 -Verbose - } - - #Disables live tiles - Write-Host "Disabling live tiles" - $Live = 'HKCU:\SOFTWARE\Policies\Microsoft\Windows\CurrentVersion\PushNotifications' - If (!(Test-Path $Live)) { - mkdir $Live -ErrorAction SilentlyContinue - New-ItemProperty $Live -Name NoTileApplicationNotification -Value 1 -Verbose - } - - #Turns off Data Collection via the AllowTelemtry key by changing it to 0 - Write-Host "Turning off Data Collection" - $DataCollection = 'HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\Policies\DataCollection' - If (Test-Path $DataCollection) { - Set-ItemProperty $DataCollection -Name AllowTelemetry -Value 0 -Verbose - } - - #Disables People icon on Taskbar - Write-Host "Disabling People icon on Taskbar" - $People = 'HKCU:\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\Advanced\People' - If (!(Test-Path $People)) { - mkdir $People -ErrorAction SilentlyContinue - New-ItemProperty $People -Name PeopleBand -Value 0 -Verbose - } - - #Disables suggestions on start menu - Write-Host "Disabling suggestions on the Start Menu" - $Suggestions = 'HKCU:\Software\Microsoft\Windows\CurrentVersion\ContentDeliveryManager' - If (Test-Path $Suggestions) { - Set-ItemProperty $Suggestions -Name SystemPaneSuggestionsEnabled -Value 0 -Verbose - } - - #Loads the registry keys/values below into the NTUSER.DAT file which prevents the apps from redownloading. Credit to a60wattfish - reg load HKU\Default_User C:\Users\Default\NTUSER.DAT - Set-ItemProperty -Path Registry::HKU\Default_User\SOFTWARE\Microsoft\Windows\CurrentVersion\ContentDeliveryManager -Name SystemPaneSuggestionsEnabled -Value 0 - Set-ItemProperty -Path Registry::HKU\Default_User\SOFTWARE\Microsoft\Windows\CurrentVersion\ContentDeliveryManager -Name PreInstalledAppsEnabled -Value 0 - Set-ItemProperty -Path Registry::HKU\Default_User\SOFTWARE\Microsoft\Windows\CurrentVersion\ContentDeliveryManager -Name OemPreInstalledAppsEnabled -Value 0 - reg unload HKU\Default_User - - #Disables scheduled tasks that are considered unnecessary - Write-Host "Disabling scheduled tasks" - #Get-ScheduledTask -TaskName XblGameSaveTaskLogon | Disable-ScheduledTask -ErrorAction SilentlyContinue - Get-ScheduledTask -TaskName XblGameSaveTask | Disable-ScheduledTask -ErrorAction SilentlyContinue - Get-ScheduledTask -TaskName Consolidator | Disable-ScheduledTask -ErrorAction SilentlyContinue - Get-ScheduledTask -TaskName UsbCeip | Disable-ScheduledTask -ErrorAction SilentlyContinue - Get-ScheduledTask -TaskName DmClient | Disable-ScheduledTask -ErrorAction SilentlyContinue - Get-ScheduledTask -TaskName DmClientOnScenarioDownload | Disable-ScheduledTask -ErrorAction SilentlyContinue - } - - #This includes fixes by xsisbest - Function FixWhitelistedApps { - $ErrorActionPreference = 'silentlycontinue' - - If (!(Get-AppxPackage -AllUsers | Select Microsoft.Paint3D, Microsoft.MSPaint, Microsoft.WindowsCalculator, Microsoft.WindowsStore, Microsoft.MicrosoftStickyNotes, Microsoft.WindowsSoundRecorder, Microsoft.Windows.Photos)) { - - #Credit to abulgatz for the 4 lines of code - Get-AppxPackage -allusers Microsoft.Paint3D | Foreach {Add-AppxPackage -DisableDevelopmentMode -Register "$($_.InstallLocation)\AppXManifest.xml"} - Get-AppxPackage -allusers Microsoft.MSPaint | Foreach {Add-AppxPackage -DisableDevelopmentMode -Register "$($_.InstallLocation)\AppXManifest.xml"} - Get-AppxPackage -allusers Microsoft.WindowsCalculator | Foreach {Add-AppxPackage -DisableDevelopmentMode -Register "$($_.InstallLocation)\AppXManifest.xml"} - Get-AppxPackage -allusers Microsoft.WindowsStore | Foreach {Add-AppxPackage -DisableDevelopmentMode -Register "$($_.InstallLocation)\AppXManifest.xml"} - Get-AppxPackage -allusers Microsoft.MicrosoftStickyNotes | Foreach {Add-AppxPackage -DisableDevelopmentMode -Register "$($_.InstallLocation)\AppXManifest.xml"} - Get-AppxPackage -allusers Microsoft.WindowsSoundRecorder | Foreach {Add-AppxPackage -DisableDevelopmentMode -Register "$($_.InstallLocation)\AppXManifest.xml"} - Get-AppxPackage -allusers Microsoft.Windows.Photos | Foreach {Add-AppxPackage -DisableDevelopmentMode -Register "$($_.InstallLocation)\AppXManifest.xml"} - } - } - - Function CheckService { - - If (Get-Service -Name dmwappushservice | Where-Object {$_.Status -eq "Stopped"}) { - Start-Service -Name dmwappushservice - } - } - - Write-Host "Initiating Sysprep" - Begin-SysPrep - Write-Host "Removing bloatware apps." - DebloatAll - DebloatBlacklist - Write-Host "Removing leftover bloatware registry keys." - Remove-Keys - Write-Host "Checking to see if any Whitelisted Apps were removed, and if so re-adding them." - FixWhitelistedApps - Write-Host "Stopping telemetry, disabling unneccessary scheduled tasks, and preventing bloatware from returning." - Protect-Privacy - #Write-Host "Stopping Edge from taking over as the default PDF Viewer." - #Stop-EdgePDF - Write-Host "Finished all tasks. `n" - - } ) -$RemoveBloatNoBlacklist.Add_Click( { - $ErrorActionPreference = 'silentlycontinue' - #This function finds any AppX/AppXProvisioned package and uninstalls it, except for Freshpaint, Windows Calculator, Windows Store, and Windows Photos. - #Also, to note - This does NOT remove essential system services/software/etc such as .NET framework installations, Cortana, Edge, etc. - - #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. - - param ( - [switch]$Debloat, [switch]$SysPrep - ) - - Function Begin-SysPrep { - $ErrorActionPreference = 'silentlycontinue' - - param([switch]$SysPrep) - Write-Host -Message ('Starting Sysprep Fixes') - - # Disable Windows Store Automatic Updates - Write-Host -Message "Adding Registry key to Disable Windows Store Automatic Updates" - $registryPath = "HKLM:\SOFTWARE\Policies\Microsoft\WindowsStore" - If (!(Test-Path $registryPath)) { - Mkdir $registryPath -ErrorAction SilentlyContinue - New-ItemProperty $registryPath -Name AutoDownload -Value 2 - } - Else { - Set-ItemProperty $registryPath -Name AutoDownload -Value 2 - } - #Stop WindowsStore Installer Service and set to Disabled - Write-Host -Message ('Stopping InstallService') - Stop-Service InstallService - Write-Host -Message ('Setting InstallService Startup to Disabled') - & Set-Service -Name InstallService -StartupType Disabled - } - - #Creates a PSDrive to be able to access the 'HKCR' tree - New-PSDrive -Name HKCR -PSProvider Registry -Root HKEY_CLASSES_ROOT - Function Start-Debloat { - $ErrorActionPreference = 'silentlycontinue' - - param([switch]$Debloat) - - #Removes AppxPackages - #Credit to Reddit user /u/GavinEke for a modified version of my whitelist code - [regex]$WhitelistedApps = 'Microsoft.ScreenSketch|Microsoft.Paint3D|Microsoft.MSPaint|Microsoft.WindowsCalculator|Microsoft.WindowsStore|Microsoft.MicrosoftStickyNotes|Microsoft.WindowsSoundRecorder|Microsoft.Windows.Photos|CanonicalGroupLimited.UbuntuonWindows' - Get-AppxPackage -AllUsers | Where-Object {$_.Name -NotMatch $WhitelistedApps} | Remove-AppxPackage -ErrorAction SilentlyContinue - # Run this again to avoid error on 1803 or having to reboot. - Get-AppxPackage -AllUsers | Where-Object {$_.Name -NotMatch $WhitelistedApps} | Remove-AppxPackage -ErrorAction SilentlyContinue - Get-AppxProvisionedPackage -Online | Where-Object {$_.PackageName -NotMatch $WhitelistedApps} | Remove-AppxProvisionedPackage -Online -ErrorAction SilentlyContinue - } - - Function Remove-Keys { - $ErrorActionPreference = 'silentlycontinue' - - Param([switch]$Debloat) - - #These are the registry keys that it will delete. - - $Keys = @( - - #Remove Background Tasks - "HKCR:\Extensions\ContractId\Windows.BackgroundTasks\PackageId\46928bounde.EclipseManager_2.2.4.51_neutral__a5h4egax66k6y" - "HKCR:\Extensions\ContractId\Windows.BackgroundTasks\PackageId\ActiproSoftwareLLC.562882FEEB491_2.6.18.18_neutral__24pqs290vpjk0" - "HKCR:\Extensions\ContractId\Windows.BackgroundTasks\PackageId\Microsoft.MicrosoftOfficeHub_17.7909.7600.0_x64__8wekyb3d8bbwe" - "HKCR:\Extensions\ContractId\Windows.BackgroundTasks\PackageId\Microsoft.PPIProjection_10.0.15063.0_neutral_neutral_cw5n1h2txyewy" - "HKCR:\Extensions\ContractId\Windows.BackgroundTasks\PackageId\Microsoft.XboxGameCallableUI_1000.15063.0.0_neutral_neutral_cw5n1h2txyewy" - "HKCR:\Extensions\ContractId\Windows.BackgroundTasks\PackageId\Microsoft.XboxGameCallableUI_1000.16299.15.0_neutral_neutral_cw5n1h2txyewy" - - #Windows File - "HKCR:\Extensions\ContractId\Windows.File\PackageId\ActiproSoftwareLLC.562882FEEB491_2.6.18.18_neutral__24pqs290vpjk0" - - #Registry keys to delete if they aren't uninstalled by RemoveAppXPackage/RemoveAppXProvisionedPackage - "HKCR:\Extensions\ContractId\Windows.Launch\PackageId\46928bounde.EclipseManager_2.2.4.51_neutral__a5h4egax66k6y" - "HKCR:\Extensions\ContractId\Windows.Launch\PackageId\ActiproSoftwareLLC.562882FEEB491_2.6.18.18_neutral__24pqs290vpjk0" - "HKCR:\Extensions\ContractId\Windows.Launch\PackageId\Microsoft.PPIProjection_10.0.15063.0_neutral_neutral_cw5n1h2txyewy" - "HKCR:\Extensions\ContractId\Windows.Launch\PackageId\Microsoft.XboxGameCallableUI_1000.15063.0.0_neutral_neutral_cw5n1h2txyewy" - "HKCR:\Extensions\ContractId\Windows.Launch\PackageId\Microsoft.XboxGameCallableUI_1000.16299.15.0_neutral_neutral_cw5n1h2txyewy" - - #Scheduled Tasks to delete - "HKCR:\Extensions\ContractId\Windows.PreInstalledConfigTask\PackageId\Microsoft.MicrosoftOfficeHub_17.7909.7600.0_x64__8wekyb3d8bbwe" - - #Windows Protocol Keys - "HKCR:\Extensions\ContractId\Windows.Protocol\PackageId\ActiproSoftwareLLC.562882FEEB491_2.6.18.18_neutral__24pqs290vpjk0" - "HKCR:\Extensions\ContractId\Windows.Protocol\PackageId\Microsoft.PPIProjection_10.0.15063.0_neutral_neutral_cw5n1h2txyewy" - "HKCR:\Extensions\ContractId\Windows.Protocol\PackageId\Microsoft.XboxGameCallableUI_1000.15063.0.0_neutral_neutral_cw5n1h2txyewy" - "HKCR:\Extensions\ContractId\Windows.Protocol\PackageId\Microsoft.XboxGameCallableUI_1000.16299.15.0_neutral_neutral_cw5n1h2txyewy" - - #Windows Share Target - "HKCR:\Extensions\ContractId\Windows.ShareTarget\PackageId\ActiproSoftwareLLC.562882FEEB491_2.6.18.18_neutral__24pqs290vpjk0" - ) - - #This writes the output of each key it is removing and also removes the keys listed above. - ForEach ($Key in $Keys) { - Write-Host "Removing $Key from registry" - Remove-Item $Key -Recurse -ErrorAction SilentlyContinue - } - } - - Function Protect-Privacy { - $ErrorActionPreference = 'silentlycontinue' - - Param([switch]$Debloat) - - #Creates a PSDrive to be able to access the 'HKCR' tree - New-PSDrive -Name HKCR -PSProvider Registry -Root HKEY_CLASSES_ROOT - - #Disables Windows Feedback Experience - Write-Host "Disabling Windows Feedback Experience program" - $Advertising = 'HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\AdvertisingInfo' - If (Test-Path $Advertising) { - Set-ItemProperty $Advertising -Name Enabled -Value 0 -Verbose - } - - #Stops Cortana from being used as part of your Windows Search Function - Write-Host "Stopping Cortana from being used as part of your Windows Search Function" - $Search = 'HKLM:\SOFTWARE\Policies\Microsoft\Windows\Windows Search' - If (Test-Path $Search) { - Set-ItemProperty $Search -Name AllowCortana -Value 0 -Verbose - } - - #Stops the Windows Feedback Experience from sending anonymous data - Write-Host "Stopping the Windows Feedback Experience program" - $Period1 = 'HKCU:\Software\Microsoft\Siuf' - $Period2 = 'HKCU:\Software\Microsoft\Siuf\Rules' - $Period3 = 'HKCU:\Software\Microsoft\Siuf\Rules\PeriodInNanoSeconds' - If (!(Test-Path $Period3)) { - mkdir $Period1 -ErrorAction SilentlyContinue - mkdir $Period2 -ErrorAction SilentlyContinue - mkdir $Period3 -ErrorAction SilentlyContinue - New-ItemProperty $Period3 -Name PeriodInNanoSeconds -Value 0 -Verbose -ErrorAction SilentlyContinue - } - - Write-Host "Adding Registry key to prevent bloatware apps from returning" - #Prevents bloatware applications from returning - $registryPath = "HKLM:\SOFTWARE\Policies\Microsoft\Windows\CloudContent" - If (!(Test-Path $registryPath)) { - Mkdir $registryPath -ErrorAction SilentlyContinue - New-ItemProperty $registryPath -Name DisableWindowsConsumerFeatures -Value 1 -Verbose -ErrorAction SilentlyContinue - } - - Write-Host "Setting Mixed Reality Portal value to 0 so that you can uninstall it in Settings" - $Holo = 'HKCU:\Software\Microsoft\Windows\CurrentVersion\Holographic' - If (Test-Path $Holo) { - Set-ItemProperty $Holo -Name FirstRunSucceeded -Value 0 -Verbose - } - - #Disables live tiles - Write-Host "Disabling live tiles" - $Live = 'HKCU:\SOFTWARE\Policies\Microsoft\Windows\CurrentVersion\PushNotifications' - If (!(Test-Path $Live)) { - mkdir $Live -ErrorAction SilentlyContinue - New-ItemProperty $Live -Name NoTileApplicationNotification -Value 1 -Verbose - } - - #Turns off Data Collection via the AllowTelemtry key by changing it to 0 - Write-Host "Turning off Data Collection" - $DataCollection = 'HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\Policies\DataCollection' - If (Test-Path $DataCollection) { - Set-ItemProperty $DataCollection -Name AllowTelemetry -Value 0 -Verbose - } - - #Disables People icon on Taskbar - Write-Host "Disabling People icon on Taskbar" - $People = 'HKCU:\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\Advanced\People' - If (!(Test-Path $People)) { - mkdir $People -ErrorAction SilentlyContinue - New-ItemProperty $People -Name PeopleBand -Value 0 -Verbose - } - - #Disables suggestions on start menu - Write-Host "Disabling suggestions on the Start Menu" - $Suggestions = 'HKCU:\Software\Microsoft\Windows\CurrentVersion\ContentDeliveryManager' - If (Test-Path $Suggestions) { - Set-ItemProperty $Suggestions -Name SystemPaneSuggestionsEnabled -Value 0 -Verbose - } - - #Loads the registry keys/values below into the NTUSER.DAT file which prevents the apps from redownloading. Credit to a60wattfish - reg load HKU\Default_User C:\Users\Default\NTUSER.DAT - Set-ItemProperty -Path Registry::HKU\Default_User\SOFTWARE\Microsoft\Windows\CurrentVersion\ContentDeliveryManager -Name SystemPaneSuggestionsEnabled -Value 0 - Set-ItemProperty -Path Registry::HKU\Default_User\SOFTWARE\Microsoft\Windows\CurrentVersion\ContentDeliveryManager -Name PreInstalledAppsEnabled -Value 0 - Set-ItemProperty -Path Registry::HKU\Default_User\SOFTWARE\Microsoft\Windows\CurrentVersion\ContentDeliveryManager -Name OemPreInstalledAppsEnabled -Value 0 - reg unload HKU\Default_User - - #Disables scheduled tasks that are considered unnecessary - Write-Host "Disabling scheduled tasks" - #Get-ScheduledTask -TaskName XblGameSaveTaskLogon | Disable-ScheduledTask -ErrorAction SilentlyContinue - Get-ScheduledTask -TaskName XblGameSaveTask | Disable-ScheduledTask -ErrorAction SilentlyContinue - Get-ScheduledTask -TaskName Consolidator | Disable-ScheduledTask -ErrorAction SilentlyContinue - Get-ScheduledTask -TaskName UsbCeip | Disable-ScheduledTask -ErrorAction SilentlyContinue - Get-ScheduledTask -TaskName DmClient | Disable-ScheduledTask -ErrorAction SilentlyContinue - Get-ScheduledTask -TaskName DmClientOnScenarioDownload | Disable-ScheduledTask -ErrorAction SilentlyContinue - } - - #This includes fixes by xsisbest - Function FixWhitelistedApps { - - Param([switch]$Debloat) - - If (!(Get-AppxPackage -AllUsers | Select Microsoft.Paint3D, Microsoft.MSPaint, Microsoft.WindowsCalculator, Microsoft.WindowsStore, Microsoft.MicrosoftStickyNotes, Microsoft.WindowsSoundRecorder, Microsoft.Windows.Photos)) { - - #Credit to abulgatz for the 4 lines of code - Get-AppxPackage -allusers Microsoft.Paint3D | Foreach {Add-AppxPackage -DisableDevelopmentMode -Register "$($_.InstallLocation)\AppXManifest.xml"} - Get-AppxPackage -allusers Microsoft.MSPaint | Foreach {Add-AppxPackage -DisableDevelopmentMode -Register "$($_.InstallLocation)\AppXManifest.xml"} - Get-AppxPackage -allusers Microsoft.WindowsCalculator | Foreach {Add-AppxPackage -DisableDevelopmentMode -Register "$($_.InstallLocation)\AppXManifest.xml"} - Get-AppxPackage -allusers Microsoft.WindowsStore | Foreach {Add-AppxPackage -DisableDevelopmentMode -Register "$($_.InstallLocation)\AppXManifest.xml"} - Get-AppxPackage -allusers Microsoft.MicrosoftStickyNotes | Foreach {Add-AppxPackage -DisableDevelopmentMode -Register "$($_.InstallLocation)\AppXManifest.xml"} - Get-AppxPackage -allusers Microsoft.WindowsSoundRecorder | Foreach {Add-AppxPackage -DisableDevelopmentMode -Register "$($_.InstallLocation)\AppXManifest.xml"} - Get-AppxPackage -allusers Microsoft.Windows.Photos | Foreach {Add-AppxPackage -DisableDevelopmentMode -Register "$($_.InstallLocation)\AppXManifest.xml"} - } - } - - Function CheckService { - - Param([switch]$Debloat) - - If (Get-Service -Name dmwappushservice | Where-Object {$_.Status -eq "Stopped"}) { - Start-Service -Name dmwappushservice - } - } - Begin-SysPrep - Write-Host "Removing bloatware apps." - Start-Debloat - Write-Host "Removing leftover bloatware registry keys." - Remove-Keys - Write-Host "Checking to see if any Whitelisted Apps were removed, and if so re-adding them." - FixWhitelistedApps - Write-Host "Stopping telemetry, disabling unneccessary scheduled tasks, and preventing bloatware from returning." - Protect-Privacy - #Write-Host "Stopping Edge from taking over as the default PDF Viewer." - Write-Host "Checking to make sure that the service 'dmwappushservice' has been started." - CheckService - Write-Host "Finished all tasks. `n" - - }) -$RevertChange.Add_Click( { - $ErrorActionPreference = 'silentlycontinue' - #This function will revert the changes you made when running the Start-Debloat function. - - #This line reinstalls all of the bloatware that was removed - Get-AppxPackage -AllUsers | ForEach {Add-AppxPackage -Verbose -DisableDevelopmentMode -Register "$($_.InstallLocation)\AppXManifest.xml"} - - #Tells Windows to enable your advertising information. - Write-Host "Re-enabling key to show advertisement information" - $Advertising = "HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\AdvertisingInfo" - If (Test-Path $Advertising) { - Set-ItemProperty $Advertising Enabled -Value 1 - } - - #Enables Cortana to be used as part of your Windows Search Function - Write-Host "Re-enabling Cortana to be used in your Windows Search" - $Search = "HKLM:\SOFTWARE\Policies\Microsoft\Windows\Windows Search" - If (Test-Path $Search) { - Set-ItemProperty $Search AllowCortana -Value 1 - } - - #Re-enables the Windows Feedback Experience for sending anonymous data - Write-Host "Re-enabling Windows Feedback Experience" - $Period = "HKCU:\Software\Microsoft\Siuf\Rules" - If (!(Test-Path $Period)) { - New-Item $Period - } - Set-ItemProperty $Period PeriodInNanoSeconds -Value 1 - - #Enables bloatware applications - Write-Host "Adding Registry key to allow bloatware apps to return" - $registryPath = "HKLM:\SOFTWARE\Policies\Microsoft\Windows\CloudContent" - If (!(Test-Path $registryPath)) { - New-Item $registryPath - } - Set-ItemProperty $registryPath DisableWindowsConsumerFeatures -Value 0 - - #Changes Mixed Reality Portal Key 'FirstRunSucceeded' to 1 - Write-Host "Setting Mixed Reality Portal value to 1" - $Holo = "HKCU:\Software\Microsoft\Windows\CurrentVersion\Holographic" - If (Test-Path $Holo) { - Set-ItemProperty $Holo FirstRunSucceeded -Value 1 - } - - #Re-enables live tiles - Write-Host "Enabling live tiles" - $Live = "HKCU:\SOFTWARE\Policies\Microsoft\Windows\CurrentVersion\PushNotifications" - If (!(Test-Path $Live)) { - New-Item $Live - } - Set-ItemProperty $Live NoTileApplicationNotification -Value 0 - - #Re-enables data collection - Write-Host "Re-enabling data collection" - $DataCollection = "HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\Policies\DataCollection" - If (!(Test-Path $DataCollection)) { - New-Item $DataCollection - } - Set-ItemProperty $DataCollection AllowTelemetry -Value 1 - - #Re-enables People Icon on Taskbar - Write-Host "Enabling People icon on Taskbar" - $People = "HKCU:\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\Advanced\People" - If (!(Test-Path $People)) { - New-Item $People - } - Set-ItemProperty $People PeopleBand -Value 1 - - #Re-enables suggestions on start menu - Write-Host "Enabling suggestions on the Start Menu" - $Suggestions = "HKCU:\Software\Microsoft\Windows\CurrentVersion\ContentDeliveryManager" - If (!(Test-Path $Suggestions)) { - New-Item $Suggestions - } - Set-ItemProperty $Suggestions SystemPaneSuggestionsEnabled -Value 1 - - #Re-enables scheduled tasks that were disabled when running the Debloat switch - Write-Host "Enabling scheduled tasks that were disabled" - Get-ScheduledTask XblGameSaveTaskLogon | Enable-ScheduledTask - Get-ScheduledTask XblGameSaveTask | Enable-ScheduledTask - Get-ScheduledTask Consolidator | Enable-ScheduledTask - Get-ScheduledTask UsbCeip | Enable-ScheduledTask - Get-ScheduledTask DmClient | Enable-ScheduledTask - Get-ScheduledTask DmClientOnScenarioDownload | Enable-ScheduledTask - - Write-Host "Re-enabling and starting WAP Push Service" - #Enable and start WAP Push Service - Set-Service "dmwappushservice" -StartupType Automatic - Start-Service "dmwappushservice" - - Write-Host "Re-enabling and starting the Diagnostics Tracking Service" - #Enabling the Diagnostics Tracking Service - Set-Service "DiagTrack" -StartupType Automatic - Start-Service "DiagTrack" - Write-Host "Done reverting changes! `n" - }) -$FixWhitelist.Add_Click( { - $ErrorActionPreference = 'silentlycontinue' - If (!(Get-AppxPackage -AllUsers | Select Microsoft.Paint3D, Microsoft.WindowsCalculator, Microsoft.WindowsStore, Microsoft.Windows.Photos)) { - - #Credit to abulgatz for these 4 lines of code - Get-AppxPackage -allusers Microsoft.Paint3D | Foreach {Add-AppxPackage -DisableDevelopmentMode -Register "$($_.InstallLocation)\AppXManifest.xml"} - Get-AppxPackage -allusers Microsoft.WindowsCalculator | Foreach {Add-AppxPackage -DisableDevelopmentMode -Register "$($_.InstallLocation)\AppXManifest.xml"} - Get-AppxPackage -allusers Microsoft.WindowsStore | Foreach {Add-AppxPackage -DisableDevelopmentMode -Register "$($_.InstallLocation)\AppXManifest.xml"} - Get-AppxPackage -allusers Microsoft.Windows.Photos | Foreach {Add-AppxPackage -DisableDevelopmentMode -Register "$($_.InstallLocation)\AppXManifest.xml"} - } - - Write-Host "Whitelisted apps were either fixed or re-added. `n" - }) -$DisableCortana.Add_Click( { - $ErrorActionPreference = 'silentlycontinue' - Write-Host "Disabling Cortana" - $Cortana1 = "HKCU:\SOFTWARE\Microsoft\Personalization\Settings" - $Cortana2 = "HKCU:\SOFTWARE\Microsoft\InputPersonalization" - $Cortana3 = "HKCU:\SOFTWARE\Microsoft\InputPersonalization\TrainedDataStore" - If (!(Test-Path $Cortana1)) { - New-Item $Cortana1 - } - Set-ItemProperty $Cortana1 AcceptedPrivacyPolicy -Value 0 - If (!(Test-Path $Cortana2)) { - New-Item $Cortana2 - } - Set-ItemProperty $Cortana2 RestrictImplicitTextCollection -Value 1 - Set-ItemProperty $Cortana2 RestrictImplicitInkCollection -Value 1 - If (!(Test-Path $Cortana3)) { - New-Item $Cortana3 - } - Set-ItemProperty $Cortana3 HarvestContacts -Value 0 - Write-Host "Cortana has been disabled. `n" - }) -$StopEdgePDFTakeover.Add_Click( { - $ErrorActionPreference = 'silentlycontinue' - #Stops edge from taking over as the default .PDF viewer - Write-Host "Stopping Edge from taking over as the default .PDF viewer" - $NoPDF = "HKCR:\.pdf" - $NoProgids = "HKCR:\.pdf\OpenWithProgids" - $NoWithList = "HKCR:\.pdf\OpenWithList" - If (!(Get-ItemProperty $NoPDF NoOpenWith)) { - New-ItemProperty $NoPDF NoOpenWith - } - If (!(Get-ItemProperty $NoPDF NoStaticDefaultVerb)) { - New-ItemProperty $NoPDF NoStaticDefaultVerb - } - If (!(Get-ItemProperty $NoProgids NoOpenWith)) { - New-ItemProperty $NoProgids NoOpenWith - } - If (!(Get-ItemProperty $NoProgids NoStaticDefaultVerb)) { - New-ItemProperty $NoProgids NoStaticDefaultVerb - } - If (!(Get-ItemProperty $NoWithList NoOpenWith)) { - New-ItemProperty $NoWithList NoOpenWith - } - If (!(Get-ItemProperty $NoWithList NoStaticDefaultVerb)) { - New-ItemProperty $NoWithList NoStaticDefaultVerb - } - - #Appends an underscore '_' to the Registry key for Edge - $Edge = "HKCR:\AppXd4nrz8ff68srnhf9t5a8sbjyar1cr723_" - If (Test-Path $Edge) { - Set-Item $Edge AppXd4nrz8ff68srnhf9t5a8sbjyar1cr723_ - } - Write-Host "Edge should no longer take over as the default .PDF. `n" - }) -$EnableCortana.Add_Click( { - $ErrorActionPreference = 'silentlycontinue' - Write-Host "Re-enabling Cortana" - $Cortana1 = "HKCU:\SOFTWARE\Microsoft\Personalization\Settings" - $Cortana2 = "HKCU:\SOFTWARE\Microsoft\InputPersonalization" - $Cortana3 = "HKCU:\SOFTWARE\Microsoft\InputPersonalization\TrainedDataStore" - If (!(Test-Path $Cortana1)) { - New-Item $Cortana1 - } - Set-ItemProperty $Cortana1 AcceptedPrivacyPolicy -Value 1 - If (!(Test-Path $Cortana2)) { - New-Item $Cortana2 - } - Set-ItemProperty $Cortana2 RestrictImplicitTextCollection -Value 0 - Set-ItemProperty $Cortana2 RestrictImplicitInkCollection -Value 0 - If (!(Test-Path $Cortana3)) { - New-Item $Cortana3 - } - Set-ItemProperty $Cortana3 HarvestContacts -Value 1 - Write-Host "Cortana has been enabled! `n" - }) -$EnableEdgePDFTakeover.Add_Click( { - New-PSDrive HKCR -PSProvider Registry -Root HKEY_CLASSES_ROOT - $ErrorActionPreference = 'silentlycontinue' - Write-Host "Setting Edge back to default" - $NoPDF = "HKCR:\.pdf" - $NoProgids = "HKCR:\.pdf\OpenWithProgids" - $NoWithList = "HKCR:\.pdf\OpenWithList" - #Sets edge back to default - If (Get-ItemProperty $NoPDF NoOpenWith) { - Remove-ItemProperty $NoPDF NoOpenWith - } - If (Get-ItemProperty $NoPDF NoStaticDefaultVerb) { - Remove-ItemProperty $NoPDF NoStaticDefaultVerb - } - If (Get-ItemProperty $NoProgids NoOpenWith) { - Remove-ItemProperty $NoProgids NoOpenWith - } - If (Get-ItemProperty $NoProgids NoStaticDefaultVerb) { - Remove-ItemProperty $NoProgids NoStaticDefaultVerb - } - If (Get-ItemProperty $NoWithList NoOpenWith) { - Remove-ItemProperty $NoWithList NoOpenWith - } - If (Get-ItemProperty $NoWithList NoStaticDefaultVerb) { - Remove-ItemProperty $NoWithList NoStaticDefaultVerb - } - - #Removes an underscore '_' from the Registry key for Edge - $Edge2 = "HKCR:\AppXd4nrz8ff68srnhf9t5a8sbjyar1cr723_" - If (Test-Path $Edge2) { - Set-Item $Edge2 AppXd4nrz8ff68srnhf9t5a8sbjyar1cr723 - } - Write-Host "Edge will now be able to be used for .PDF. `n" - }) -$DisableTelemetry.Add_Click( { - $ErrorActionPreference = 'silentlycontinue' - #Disables Windows Feedback Experience - Write-Host "Disabling Windows Feedback Experience program" - $Advertising = "HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\AdvertisingInfo" - If (Test-Path $Advertising) { - Set-ItemProperty $Advertising Enabled -Value 0 - } - - #Stops Cortana from being used as part of your Windows Search Function - Write-Host "Stopping Cortana from being used as part of your Windows Search Function" - $Search = "HKLM:\SOFTWARE\Policies\Microsoft\Windows\Windows Search" - If (Test-Path $Search) { - Set-ItemProperty $Search AllowCortana -Value 0 - } - - #Disables Web Search in Start Menu - Write-Host "Disabling Bing Search in Start Menu" - $WebSearch = "HKLM:\SOFTWARE\Policies\Microsoft\Windows\Windows Search" - Set-ItemProperty "HKCU:\SOFTWARE\Microsoft\Windows\CurrentVersion\Search" BingSearchEnabled -Value 0 - If (!(Test-Path $WebSearch)) { - New-Item $WebSearch - } - Set-ItemProperty $WebSearch DisableWebSearch -Value 1 - - #Stops the Windows Feedback Experience from sending anonymous data - Write-Host "Stopping the Windows Feedback Experience program" - $Period = "HKCU:\Software\Microsoft\Siuf\Rules" - If (!(Test-Path $Period)) { - New-Item $Period - } - Set-ItemProperty $Period PeriodInNanoSeconds -Value 0 - - #Prevents bloatware applications from returning and removes Start Menu suggestions - Write-Host "Adding Registry key to prevent bloatware apps from returning" - $registryPath = "HKLM:\SOFTWARE\Policies\Microsoft\Windows\CloudContent" - $registryOEM = "HKCU:\SOFTWARE\Microsoft\Windows\CurrentVersion\ContentDeliveryManager" - If (!(Test-Path $registryPath)) { - New-Item $registryPath - } - Set-ItemProperty $registryPath DisableWindowsConsumerFeatures -Value 1 - - If (!(Test-Path $registryOEM)) { - New-Item $registryOEM - } - Set-ItemProperty $registryOEM ContentDeliveryAllowed -Value 0 - Set-ItemProperty $registryOEM OemPreInstalledAppsEnabled -Value 0 - Set-ItemProperty $registryOEM PreInstalledAppsEnabled -Value 0 - Set-ItemProperty $registryOEM PreInstalledAppsEverEnabled -Value 0 - Set-ItemProperty $registryOEM SilentInstalledAppsEnabled -Value 0 - Set-ItemProperty $registryOEM SystemPaneSuggestionsEnabled -Value 0 - - #Preping mixed Reality Portal for removal - Write-Host "Setting Mixed Reality Portal value to 0 so that you can uninstall it in Settings" - $Holo = "HKCU:\Software\Microsoft\Windows\CurrentVersion\Holographic" - If (Test-Path $Holo) { - Set-ItemProperty $Holo FirstRunSucceeded -Value 0 - } - - #Disables Wi-fi Sense - Write-Host "Disabling Wi-Fi Sense" - $WifiSense1 = "HKLM:\SOFTWARE\Microsoft\PolicyManager\default\WiFi\AllowWiFiHotSpotReporting" - $WifiSense2 = "HKLM:\SOFTWARE\Microsoft\PolicyManager\default\WiFi\AllowAutoConnectToWiFiSenseHotspots" - $WifiSense3 = "HKLM:\SOFTWARE\Microsoft\WcmSvc\wifinetworkmanager\config" - If (!(Test-Path $WifiSense1)) { - New-Item $WifiSense1 - } - Set-ItemProperty $WifiSense1 Value -Value 0 - If (!(Test-Path $WifiSense2)) { - New-Item $WifiSense2 - } - Set-ItemProperty $WifiSense2 Value -Value 0 - Set-ItemProperty $WifiSense3 AutoConnectAllowedOEM -Value 0 - - #Disables live tiles - Write-Host "Disabling live tiles" - $Live = "HKCU:\SOFTWARE\Policies\Microsoft\Windows\CurrentVersion\PushNotifications" - If (!(Test-Path $Live)) { - New-Item $Live - } - Set-ItemProperty $Live NoTileApplicationNotification -Value 1 - - #Turns off Data Collection via the AllowTelemtry key by changing it to 0 - Write-Host "Turning off Data Collection" - $DataCollection1 = "HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\Policies\DataCollection" - $DataCollection2 = "HKLM:\SOFTWARE\Policies\Microsoft\Windows\DataCollection" - $DataCollection3 = "HKLM:\SOFTWARE\Wow6432Node\Microsoft\Windows\CurrentVersion\Policies\DataCollection" - If (Test-Path $DataCollection1) { - Set-ItemProperty $DataCollection1 AllowTelemetry -Value 0 - } - If (Test-Path $DataCollection2) { - Set-ItemProperty $DataCollection2 AllowTelemetry -Value 0 - } - If (Test-Path $DataCollection3) { - Set-ItemProperty $DataCollection3 AllowTelemetry -Value 0 - } - - #Disabling Location Tracking - Write-Host "Disabling Location Tracking" - $SensorState = "HKLM:\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Sensor\Overrides\{BFA794E4-F964-4FDB-90F6-51056BFE4B44}" - $LocationConfig = "HKLM:\SYSTEM\CurrentControlSet\Services\lfsvc\Service\Configuration" - If (!(Test-Path $SensorState)) { - New-Item $SensorState - } - Set-ItemProperty $SensorState SensorPermissionState -Value 0 - If (!(Test-Path $LocationConfig)) { - New-Item $LocationConfig - } - Set-ItemProperty $LocationConfig Status -Value 0 - - #Disables People icon on Taskbar - Write-Host "Disabling People icon on Taskbar" - $People = "HKCU:\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\Advanced\People" - If (!(Test-Path $People)) { - New-Item $People - } - Set-ItemProperty $People PeopleBand -Value 0 - - #Disables scheduled tasks that are considered unnecessary - Write-Host "Disabling scheduled tasks" - Get-ScheduledTask XblGameSaveTaskLogon | Disable-ScheduledTask - Get-ScheduledTask XblGameSaveTask | Disable-ScheduledTask - Get-ScheduledTask Consolidator | Disable-ScheduledTask - Get-ScheduledTask UsbCeip | Disable-ScheduledTask - Get-ScheduledTask DmClient | Disable-ScheduledTask - Get-ScheduledTask DmClientOnScenarioDownload | Disable-ScheduledTask - - #Write-Host "Uninstalling Telemetry Windows Updates" - #Uninstalls Some Windows Updates considered to be Telemetry. !WIP! - #Wusa /Uninstall /KB:3022345 /norestart /quiet - #Wusa /Uninstall /KB:3068708 /norestart /quiet - #Wusa /Uninstall /KB:3075249 /norestart /quiet - #Wusa /Uninstall /KB:3080149 /norestart /quiet - - Write-Host "Stopping and disabling WAP Push Service" - #Stop and disable WAP Push Service - Stop-Service "dmwappushservice" - Set-Service "dmwappushservice" -StartupType Disabled - - Write-Host "Stopping and disabling Diagnostics Tracking Service" - #Disabling the Diagnostics Tracking Service - Stop-Service "DiagTrack" - Set-Service "DiagTrack" -StartupType Disabled - Write-Host "Telemetry has been disabled! `n" - }) -$RemoveRegkeys.Add_Click( { - $ErrorActionPreference = 'silentlycontinue' - $Keys = @( - - New-PSDrive HKCR -PSProvider Registry -Root HKEY_CLASSES_ROOT - #Remove Background Tasks - "HKCR:\Extensions\ContractId\Windows.BackgroundTasks\PackageId\46928bounde.EclipseManager_2.2.4.51_neutral__a5h4egax66k6y" - "HKCR:\Extensions\ContractId\Windows.BackgroundTasks\PackageId\ActiproSoftwareLLC.562882FEEB491_2.6.18.18_neutral__24pqs290vpjk0" - "HKCR:\Extensions\ContractId\Windows.BackgroundTasks\PackageId\Microsoft.MicrosoftOfficeHub_17.7909.7600.0_x64__8wekyb3d8bbwe" - "HKCR:\Extensions\ContractId\Windows.BackgroundTasks\PackageId\Microsoft.PPIProjection_10.0.15063.0_neutral_neutral_cw5n1h2txyewy" - "HKCR:\Extensions\ContractId\Windows.BackgroundTasks\PackageId\Microsoft.XboxGameCallableUI_1000.15063.0.0_neutral_neutral_cw5n1h2txyewy" - "HKCR:\Extensions\ContractId\Windows.BackgroundTasks\PackageId\Microsoft.XboxGameCallableUI_1000.16299.15.0_neutral_neutral_cw5n1h2txyewy" - - #Windows File - "HKCR:\Extensions\ContractId\Windows.File\PackageId\ActiproSoftwareLLC.562882FEEB491_2.6.18.18_neutral__24pqs290vpjk0" - - #Registry keys to delete if they aren't uninstalled by RemoveAppXPackage/RemoveAppXProvisionedPackage - "HKCR:\Extensions\ContractId\Windows.Launch\PackageId\46928bounde.EclipseManager_2.2.4.51_neutral__a5h4egax66k6y" - "HKCR:\Extensions\ContractId\Windows.Launch\PackageId\ActiproSoftwareLLC.562882FEEB491_2.6.18.18_neutral__24pqs290vpjk0" - "HKCR:\Extensions\ContractId\Windows.Launch\PackageId\Microsoft.PPIProjection_10.0.15063.0_neutral_neutral_cw5n1h2txyewy" - "HKCR:\Extensions\ContractId\Windows.Launch\PackageId\Microsoft.XboxGameCallableUI_1000.15063.0.0_neutral_neutral_cw5n1h2txyewy" - "HKCR:\Extensions\ContractId\Windows.Launch\PackageId\Microsoft.XboxGameCallableUI_1000.16299.15.0_neutral_neutral_cw5n1h2txyewy" - - #Scheduled Tasks to delete - "HKCR:\Extensions\ContractId\Windows.PreInstalledConfigTask\PackageId\Microsoft.MicrosoftOfficeHub_17.7909.7600.0_x64__8wekyb3d8bbwe" - - #Windows Protocol Keys - "HKCR:\Extensions\ContractId\Windows.Protocol\PackageId\ActiproSoftwareLLC.562882FEEB491_2.6.18.18_neutral__24pqs290vpjk0" - "HKCR:\Extensions\ContractId\Windows.Protocol\PackageId\Microsoft.PPIProjection_10.0.15063.0_neutral_neutral_cw5n1h2txyewy" - "HKCR:\Extensions\ContractId\Windows.Protocol\PackageId\Microsoft.XboxGameCallableUI_1000.15063.0.0_neutral_neutral_cw5n1h2txyewy" - "HKCR:\Extensions\ContractId\Windows.Protocol\PackageId\Microsoft.XboxGameCallableUI_1000.16299.15.0_neutral_neutral_cw5n1h2txyewy" - - #Windows Share Target - "HKCR:\Extensions\ContractId\Windows.ShareTarget\PackageId\ActiproSoftwareLLC.562882FEEB491_2.6.18.18_neutral__24pqs290vpjk0" - ) - - #This writes the output of each key it is removing and also removes the keys listed above. - ForEach ($Key in $Keys) { - Write-Host "Removing $Key from registry" - Remove-Item $Key -Recurse - } - Write-Host "Additional bloatware keys have been removed! `n" - }) -$RemoveOnedrive.Add_Click( { - Write-Host "Uninstalling OneDrive. Please wait..." - - New-PSDrive HKCR -PSProvider Registry -Root HKEY_CLASSES_ROOT - $onedrive = "$env:SYSTEMROOT\SysWOW64\OneDriveSetup.exe" - $ExplorerReg1 = "HKCR:\CLSID\{018D5C66-4533-4307-9B53-224DE2ED1FE6}" - $ExplorerReg2 = "HKCR:\Wow6432Node\CLSID\{018D5C66-4533-4307-9B53-224DE2ED1FE6}" - Stop-Process -Name "OneDrive*" - Start-Sleep 2 - If (!(Test-Path $onedrive)) { - $onedrive = "$env:SYSTEMROOT\System32\OneDriveSetup.exe" - } - Start-Process $onedrive "/uninstall" -NoNewWindow -Wait - Start-Sleep 2 - Write-Host "Stopping explorer" - Start-Sleep 1 - .\taskkill.exe /F /IM explorer.exe - Start-Sleep 3 - Write-Host "Removing leftover files" - Remove-Item "$env:USERPROFILE\OneDrive" -Force -Recurse - Remove-Item "$env:LOCALAPPDATA\Microsoft\OneDrive" -Force -Recurse - Remove-Item "$env:PROGRAMDATA\Microsoft OneDrive" -Force -Recurse - If (Test-Path "$env:SYSTEMDRIVE\OneDriveTemp") { - Remove-Item "$env:SYSTEMDRIVE\OneDriveTemp" -Force -Recurse - } - Write-Host "Removing OneDrive from windows explorer" - If (!(Test-Path $ExplorerReg1)) { - New-Item $ExplorerReg1 - } - Set-ItemProperty $ExplorerReg1 System.IsPinnedToNameSpaceTree -Value 0 - If (!(Test-Path $ExplorerReg2)) { - New-Item $ExplorerReg2 - } - Set-ItemProperty $ExplorerReg2 System.IsPinnedToNameSpaceTree -Value 0 - Write-Host "Restarting Explorer that was shut down before." - Start-Process explorer.exe -NoNewWindow - Write-Host "OneDrive has been successfully uninstalled! `n" - }) -#endregion events } - -#endregion GUI } - -[void]$Form.ShowDialog() +Add-Type -AssemblyName System.Drawing + +$ErrorPreference = 'SilentlyContinue' +$VerbosePreference = 'Continue' + +$form = New-Object System.Windows.Forms.Form +$form.Text = 'Windows10Debloater' +$form.Size = New-Object System.Drawing.Size(800,600) +$form.StartPosition = 'CenterScreen' + +$OKButton = New-Object System.Windows.Forms.Button +$OKButton.Location = New-Object System.Drawing.Point(275,40) +$OKButton.Size = New-Object System.Drawing.Size(225,23) +$OKButton.Text = 'Remove Selected Bloatware Packages' +$OKButton.DialogResult = [System.Windows.Forms.DialogResult]::OK +$form.AcceptButton = $OKButton +$form.Controls.Add($OKButton) + +$RemoveKeys = New-Object system.Windows.Forms.Button +$RemoveKeys.text = "BRUH" +$RemoveKeys.width = 225 +$RemoveKeys.height = 23 +$RemoveKeys.location = New-Object System.Drawing.Point(275,305) +#$WhitelistDebloat.Font = 'Microsoft Sans Serif,10' + +$label = New-Object System.Windows.Forms.Label +$label.Location = New-Object System.Drawing.Point(10,20) +$label.Size = New-Object System.Drawing.Size(280,20) +$label.Text = 'Select Default Bloatware Packages To Remove:' +$form.Controls.Add($label) + +$listBox = New-Object System.Windows.Forms.ListBox +$listBox.Location = New-Object System.Drawing.Point(10,40) +$listBox.Size = New-Object System.Drawing.Size(260,500) +#$listBox.Height = 80 + +$label2 = New-Object System.Windows.Forms.Label +$label2.Location = New-Object System.Drawing.Point(275,145) +$label2.Size = New-Object System.Drawing.Size(280,30) +$label2.Text = 'This is used to remove other packages besides the ones chosen on the left hand side' +$form.Controls.Add($label2) + +$label3 = New-Object System.Windows.Forms.Label +$label3.Location = New-Object System.Drawing.Point(275,285) +$label3.Size = New-Object System.Drawing.Size(500,100) +$label3.Text = '_______________________________________________________________________________' +$form.Controls.Add($label3) + +$label4 = New-Object System.Windows.Forms.Label +$label4.Location = New-Object System.Drawing.Point(275,265) +$label4.Size = New-Object System.Drawing.Size(500,100) +$label4.Text = 'ADVANCED OPTIONS BELOW' +$form.Controls.Add($label4) + +$WhitelistDebloat = New-Object system.Windows.Forms.Button +$WhitelistDebloat.text = "Remove extra packages besides the default bloatware" +$WhitelistDebloat.width = 285 +$WhitelistDebloat.height = 30 +$WhitelistDebloat.location = New-Object System.Drawing.Point(275,175) +#$WhitelistDebloat.Font = 'Microsoft Sans Serif,10' + +$Form.controls.AddRange(@($WhitelistDebloat,$RemoveKeys)) + +$WhitelistDebloat.Add_Click({ +Function DebloatAll { + #Removes AppxPackages + #Credit to /u/GavinEke for a modified version of my whitelist code + $WhitelistedApps = 'Microsoft.ScreenSketch|Microsoft.Paint3D|Microsoft.WindowsCalculator|Microsoft.WindowsStore|Microsoft.Windows.Photos|CanonicalGroupLimited.UbuntuonWindows|` + Microsoft.XboxGameCallableUI|Microsoft.XboxGamingOverlay|Microsoft.Xbox.TCUI|Microsoft.XboxGamingOverlay|Microsoft.XboxIdentityProvider|Microsoft.MicrosoftStickyNotes|Microsoft.MSPaint|Microsoft.WindowsCamera|.NET|Framework|` + Microsoft.HEIFImageExtension|Microsoft.ScreenSketch|Microsoft.StorePurchaseApp|Microsoft.VP9VideoExtensions|Microsoft.WebMediaExtensions|Microsoft.WebpImageExtension|Microsoft.DesktopAppInstaller|WindSynthBerry|MIDIBerry|Slack' + #NonRemovable Apps that where getting attempted and the system would reject the uninstall, speeds up debloat and prevents 'initalizing' overlay when removing apps + $NonRemovable = '1527c705-839a-4832-9118-54d4Bd6a0c89|c5e2524a-ea46-4f67-841f-6a9465d9d515|E2A4F912-2574-4A75-9BB0-0D023378592B|F46D4000-FD22-4DB4-AC8E-4E1DDDE828FE|InputApp|Microsoft.AAD.BrokerPlugin|Microsoft.AccountsControl|` + Microsoft.BioEnrollment|Microsoft.CredDialogHost|Microsoft.ECApp|Microsoft.LockApp|Microsoft.MicrosoftEdgeDevToolsClient|Microsoft.MicrosoftEdge|Microsoft.PPIProjection|Microsoft.Win32WebViewHost|Microsoft.Windows.Apprep.ChxApp|` + Microsoft.Windows.AssignedAccessLockApp|Microsoft.Windows.CapturePicker|Microsoft.Windows.CloudExperienceHost|Microsoft.Windows.ContentDeliveryManager|Microsoft.Windows.Cortana|Microsoft.Windows.NarratorQuickStart|` + Microsoft.Windows.ParentalControls|Microsoft.Windows.PeopleExperienceHost|Microsoft.Windows.PinningConfirmationDialog|Microsoft.Windows.SecHealthUI|Microsoft.Windows.SecureAssessmentBrowser|Microsoft.Windows.ShellExperienceHost|` + Microsoft.Windows.XGpuEjectDialog|Microsoft.XboxGameCallableUI|Windows.CBSPreview|windows.immersivecontrolpanel|Windows.PrintDialog|Microsoft.VCLibs.140.00|Microsoft.Services.Store.Engagement|Microsoft.UI.Xaml.2.0' + Get-AppxPackage -AllUsers | Where {$_.Name -NotMatch $WhitelistedApps -and $_.Name -NotMatch $NonRemovable} | Remove-AppxPackage + Get-AppxPackage | Where {$_.Name -NotMatch $WhitelistedApps -and $_.Name -NotMatch $NonRemovable} | Remove-AppxPackage + Get-AppxProvisionedPackage -Online | Where {$_.Name -NotMatch $WhitelistedApps -and $_.Name -NotMatch $NonRemovable} | Remove-AppxProvisionedPackage -Online +} + +Debloatall + + }) + + +$listBox.SelectionMode = 'MultiExtended' + +[void] $listBox.Items.Add('Microsoft.BingNews') +[void] $listBox.Items.Add('Microsoft.GetHelp') +[void] $listBox.Items.Add('Microsoft.Getstarted') +[void] $listBox.Items.Add('Microsoft.Messaging') +[void] $listBox.Items.Add('Microsoft.Microsoft3DViewer') +[void] $listBox.Items.Add('Microsoft.MicrosoftOfficeHub') +[void] $listBox.Items.Add('Microsoft.MicrosoftSolitaireCollection') +[void] $listBox.Items.Add('Microsoft.NetworkSpeedTest') +[void] $listBox.Items.Add('Microsoft.News') +[void] $listBox.Items.Add('Microsoft.Office.Lens') +[void] $listBox.Items.Add('Microsoft.Office.OneNote') +[void] $listBox.Items.Add('Microsoft.Office.Sway') +[void] $listBox.Items.Add('Microsoft.OneConnect') +[void] $listBox.Items.Add('Microsoft.People') +[void] $listBox.Items.Add('Microsoft.Print3D') +[void] $listBox.Items.Add('Microsoft.RemoteDesktop') +[void] $listBox.Items.Add('Microsoft.SkypeApp') +[void] $listBox.Items.Add('Microsoft.StorePurchaseApp') +[void] $listBox.Items.Add('Microsoft.Office.Todo.List') +[void] $listBox.Items.Add('Microsoft.Whiteboard') +[void] $listBox.Items.Add('Microsoft.WindowsAlarms') +[void] $listBox.Items.Add('Microsoft.WindowsCamera') +[void] $listBox.Items.Add('microsoft.windowscommunicationsapps') +[void] $listBox.Items.Add('Microsoft.WindowsFeedbackHub') +[void] $listBox.Items.Add('Microsoft.WindowsMaps') +[void] $listBox.Items.Add('Microsoft.WindowsSoundRecorder') +[void] $listBox.Items.Add('Microsoft.Xbox.TCUI') +[void] $listBox.Items.Add('Microsoft.XboxApp') +[void] $listBox.Items.Add('Microsoft.XboxGameOverlay') +[void] $listBox.Items.Add('Microsoft.XboxIdentityProvider') +[void] $listBox.Items.Add('Microsoft.XboxSpeechToTextOverlay') +[void] $listBox.Items.Add('Microsoft.ZuneMusic') +[void] $listBox.Items.Add('Microsoft.ZuneVideo') +[void] $listBox.Items.Add('*EclipseManager*') +[void] $listBox.Items.Add('*ActiproSoftwareLLC*') +[void] $listBox.Items.Add('*AdobeSystemsIncorporated.AdobePhotoshopExpress*') +[void] $listBox.Items.Add('*Duolingo-LearnLanguagesforFree*') +[void] $listBox.Items.Add('*PandoraMediaInc*') +[void] $listBox.Items.Add('*CandyCrush*') +[void] $listBox.Items.Add('*Wunderlist*') +[void] $listBox.Items.Add('*Flipboard*') +[void] $listBox.Items.Add('*Twitter*') +[void] $listBox.Items.Add('*Facebook*') +[void] $listBox.Items.Add('*Spotify*') +[void] $listBox.Items.Add('*Minecraft*') +[void] $listBox.Items.Add('*Royal Revolt*') +[void] $listBox.Items.Add('*Sway*') +[void] $listBox.Items.Add('*Speed Test*') +[void] $listBox.Items.Add('*Dolby*') +[void] $listBox.Items.Add('*Windows.CBSPreview*') +[void] $listBox.Items.Add('*Microsoft.Advertising.Xaml_10.1712.5.0_x64__8wekyb3d8bbwe*') +[void] $listBox.Items.Add('*Microsoft.Advertising.Xaml_10.1712.5.0_x86__8wekyb3d8bbwe*') +[void] $listBox.Items.Add('*Microsoft.BingWeather*') +[void] $listBox.Items.Add('*Microsoft.MSPaint*') +[void] $listBox.Items.Add('*Microsoft.MicrosoftStickyNotes*') +[void] $listBox.Items.Add('*Microsoft.Windows.Photos*') +[void] $listBox.Items.Add('*Microsoft.WindowsCalculator*') +[void] $listBox.Items.Add('*Microsoft.WindowsStore*') + +$form.Controls.Add($listBox) + +$form.Topmost = $true + +$result = $form.ShowDialog() + +if ($result -eq [System.Windows.Forms.DialogResult]::OK) +{ + $x = $listBox.SelectedItems + foreach ($x in $x) { + Get-AppxPackage -Name $x| Remove-AppxPackage + Get-AppxProvisionedPackage -Online | Where-Object DisplayName -like $x | Remove-AppxProvisionedPackage -Online + Write-Verbose "Trying to remove $x." + } +} From b14354aa678afe790c79edce0ea308912d2c467f Mon Sep 17 00:00:00 2001 From: Richard Newton Date: Sat, 20 Apr 2019 23:31:24 -0700 Subject: [PATCH 07/15] Fixed removekeys button --- Windows10DebloaterGUI.ps1 | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/Windows10DebloaterGUI.ps1 b/Windows10DebloaterGUI.ps1 index 76081587..22ca6cb3 100644 --- a/Windows10DebloaterGUI.ps1 +++ b/Windows10DebloaterGUI.ps1 @@ -18,10 +18,11 @@ $form.AcceptButton = $OKButton $form.Controls.Add($OKButton) $RemoveKeys = New-Object system.Windows.Forms.Button -$RemoveKeys.text = "BRUH" -$RemoveKeys.width = 225 +$RemoveKeys.text = "Remove registry keys associated with Bloatware" +$RemoveKeys.width = 265 $RemoveKeys.height = 23 -$RemoveKeys.location = New-Object System.Drawing.Point(275,305) +$RemoveKeys.location = New-Object System.Drawing.Point(275,400) +$form.Controls.Add($RemoveKeys) #$WhitelistDebloat.Font = 'Microsoft Sans Serif,10' $label = New-Object System.Windows.Forms.Label From 5aed4495499af89a44b3e5cc66e9d446350122f9 Mon Sep 17 00:00:00 2001 From: Richard Newton Date: Sat, 20 Apr 2019 23:58:38 -0700 Subject: [PATCH 08/15] Update Windows10DebloaterGUI.ps1 --- Windows10DebloaterGUI.ps1 | 49 ++++++++++++++++++++++++++++++++++++++- 1 file changed, 48 insertions(+), 1 deletion(-) diff --git a/Windows10DebloaterGUI.ps1 b/Windows10DebloaterGUI.ps1 index 22ca6cb3..a25c962d 100644 --- a/Windows10DebloaterGUI.ps1 +++ b/Windows10DebloaterGUI.ps1 @@ -44,7 +44,7 @@ $form.Controls.Add($label2) $label3 = New-Object System.Windows.Forms.Label $label3.Location = New-Object System.Drawing.Point(275,285) -$label3.Size = New-Object System.Drawing.Size(500,100) +$label3.Size = New-Object System.Drawing.Size(500,15) $label3.Text = '_______________________________________________________________________________' $form.Controls.Add($label3) @@ -85,6 +85,53 @@ Debloatall }) + $RemoveKeys.Add_Click({ + Function Remove-Keys { + + #These are the registry keys that it will delete. + + $Keys = @( + + #Remove Background Tasks + "HKCR:\Extensions\ContractId\Windows.BackgroundTasks\PackageId\46928bounde.EclipseManager_2.2.4.51_neutral__a5h4egax66k6y" + "HKCR:\Extensions\ContractId\Windows.BackgroundTasks\PackageId\ActiproSoftwareLLC.562882FEEB491_2.6.18.18_neutral__24pqs290vpjk0" + "HKCR:\Extensions\ContractId\Windows.BackgroundTasks\PackageId\Microsoft.MicrosoftOfficeHub_17.7909.7600.0_x64__8wekyb3d8bbwe" + "HKCR:\Extensions\ContractId\Windows.BackgroundTasks\PackageId\Microsoft.PPIProjection_10.0.15063.0_neutral_neutral_cw5n1h2txyewy" + "HKCR:\Extensions\ContractId\Windows.BackgroundTasks\PackageId\Microsoft.XboxGameCallableUI_1000.15063.0.0_neutral_neutral_cw5n1h2txyewy" + "HKCR:\Extensions\ContractId\Windows.BackgroundTasks\PackageId\Microsoft.XboxGameCallableUI_1000.16299.15.0_neutral_neutral_cw5n1h2txyewy" + + #Windows File + "HKCR:\Extensions\ContractId\Windows.File\PackageId\ActiproSoftwareLLC.562882FEEB491_2.6.18.18_neutral__24pqs290vpjk0" + + #Registry keys to delete if they aren't uninstalled by RemoveAppXPackage/RemoveAppXProvisionedPackage + "HKCR:\Extensions\ContractId\Windows.Launch\PackageId\46928bounde.EclipseManager_2.2.4.51_neutral__a5h4egax66k6y" + "HKCR:\Extensions\ContractId\Windows.Launch\PackageId\ActiproSoftwareLLC.562882FEEB491_2.6.18.18_neutral__24pqs290vpjk0" + "HKCR:\Extensions\ContractId\Windows.Launch\PackageId\Microsoft.PPIProjection_10.0.15063.0_neutral_neutral_cw5n1h2txyewy" + "HKCR:\Extensions\ContractId\Windows.Launch\PackageId\Microsoft.XboxGameCallableUI_1000.15063.0.0_neutral_neutral_cw5n1h2txyewy" + "HKCR:\Extensions\ContractId\Windows.Launch\PackageId\Microsoft.XboxGameCallableUI_1000.16299.15.0_neutral_neutral_cw5n1h2txyewy" + + #Scheduled Tasks to delete + "HKCR:\Extensions\ContractId\Windows.PreInstalledConfigTask\PackageId\Microsoft.MicrosoftOfficeHub_17.7909.7600.0_x64__8wekyb3d8bbwe" + + #Windows Protocol Keys + "HKCR:\Extensions\ContractId\Windows.Protocol\PackageId\ActiproSoftwareLLC.562882FEEB491_2.6.18.18_neutral__24pqs290vpjk0" + "HKCR:\Extensions\ContractId\Windows.Protocol\PackageId\Microsoft.PPIProjection_10.0.15063.0_neutral_neutral_cw5n1h2txyewy" + "HKCR:\Extensions\ContractId\Windows.Protocol\PackageId\Microsoft.XboxGameCallableUI_1000.15063.0.0_neutral_neutral_cw5n1h2txyewy" + "HKCR:\Extensions\ContractId\Windows.Protocol\PackageId\Microsoft.XboxGameCallableUI_1000.16299.15.0_neutral_neutral_cw5n1h2txyewy" + + #Windows Share Target + "HKCR:\Extensions\ContractId\Windows.ShareTarget\PackageId\ActiproSoftwareLLC.562882FEEB491_2.6.18.18_neutral__24pqs290vpjk0" + ) + + #This writes the output of each key it is removing and also removes the keys listed above. + ForEach ($Key in $Keys) { + Write-Verbose "Removing $Key from registry" + Remove-Item $Key -Recurse + } +Remove-Keys +} +}) + $listBox.SelectionMode = 'MultiExtended' From 0069a1534021af831b8edcb67808d818197918a4 Mon Sep 17 00:00:00 2001 From: Richard Newton Date: Wed, 24 Apr 2019 21:22:08 -0700 Subject: [PATCH 09/15] Added Disable Telemetry button --- Windows10DebloaterGUI.ps1 | 118 +++++++++++++++++++++++++++++++++++++- 1 file changed, 116 insertions(+), 2 deletions(-) diff --git a/Windows10DebloaterGUI.ps1 b/Windows10DebloaterGUI.ps1 index a25c962d..52c87b90 100644 --- a/Windows10DebloaterGUI.ps1 +++ b/Windows10DebloaterGUI.ps1 @@ -25,6 +25,14 @@ $RemoveKeys.location = New-Object System.Drawing.Point(275,400) $form.Controls.Add($RemoveKeys) #$WhitelistDebloat.Font = 'Microsoft Sans Serif,10' +$ProtectPrivacy = New-Object system.Windows.Forms.Button +$ProtectPrivacy.text = "Disable Telemetry" +$ProtectPrivacy.width = 265 +$ProtectPrivacy.height = 23 +$ProtectPrivacy.location = New-Object System.Drawing.Point(275,365) +$form.Controls.Add($ProtectPrivacy) +#$WhitelistDebloat.Font = 'Microsoft Sans Serif,10' + $label = New-Object System.Windows.Forms.Label $label.Location = New-Object System.Drawing.Point(10,20) $label.Size = New-Object System.Drawing.Size(280,20) @@ -61,7 +69,7 @@ $WhitelistDebloat.height = 30 $WhitelistDebloat.location = New-Object System.Drawing.Point(275,175) #$WhitelistDebloat.Font = 'Microsoft Sans Serif,10' -$Form.controls.AddRange(@($WhitelistDebloat,$RemoveKeys)) +$Form.controls.AddRange(@($WhitelistDebloat,$RemoveKeys,$ProtectPrivacy)) $WhitelistDebloat.Add_Click({ Function DebloatAll { @@ -85,8 +93,11 @@ Debloatall }) + New-PSDrive -Name HKCR -PSProvider Registry -Root HKEY_CLASSES_ROOT $RemoveKeys.Add_Click({ Function Remove-Keys { + + New-PSDrive -Name HKCR -PSProvider Registry -Root HKEY_CLASSES_ROOT #These are the registry keys that it will delete. @@ -128,8 +139,111 @@ Debloatall Write-Verbose "Removing $Key from registry" Remove-Item $Key -Recurse } -Remove-Keys } +Remove-Keys +}) + +$ProtectPrivacy.Add_Click({ +Function ProtectPrivacy { + + #Creates a PSDrive to be able to access the 'HKCR' tree + New-PSDrive -Name HKCR -PSProvider Registry -Root HKEY_CLASSES_ROOT + + #Disables Windows Feedback Experience + Write-Host "Disabling Windows Feedback Experience program" + $Advertising = 'HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\AdvertisingInfo' + If (Test-Path $Advertising) { + Set-ItemProperty $Advertising Enabled -Value 0 + } + + #Stops Cortana from being used as part of your Windows Search Function + Write-Host "Stopping Cortana from being used as part of your Windows Search Function" + $Search = 'HKLM:\SOFTWARE\Policies\Microsoft\Windows\Windows Search' + If (Test-Path $Search) { + Set-ItemProperty $Search AllowCortana -Value 0 + } + + #Stops the Windows Feedback Experience from sending anonymous data + Write-Host "Stopping the Windows Feedback Experience program" + $Period1 = 'HKCU:\Software\Microsoft\Siuf' + $Period2 = 'HKCU:\Software\Microsoft\Siuf\Rules' + $Period3 = 'HKCU:\Software\Microsoft\Siuf\Rules\PeriodInNanoSeconds' + If (!(Test-Path $Period3)) { + mkdir $Period1 + mkdir $Period2 + mkdir $Period3 + New-ItemProperty $Period3 PeriodInNanoSeconds -Value 0 + } + + Write-Host "Adding Registry key to prevent bloatware apps from returning" + #Prevents bloatware applications from returning + $registryPath = "HKLM:\SOFTWARE\Policies\Microsoft\Windows\CloudContent" + If (!(Test-Path $registryPath)) { + Mkdir $registryPath + New-ItemProperty $registryPath DisableWindowsConsumerFeatures -Value 1 + } + + Write-Host "Setting Mixed Reality Portal value to 0 so that you can uninstall it in Settings" + $Holo = 'HKCU:\Software\Microsoft\Windows\CurrentVersion\Holographic' + If (Test-Path $Holo) { + Set-ItemProperty $Holo FirstRunSucceeded -Value 0 + } + + #Disables live tiles + Write-Host "Disabling live tiles" + $Live = 'HKCU:\SOFTWARE\Policies\Microsoft\Windows\CurrentVersion\PushNotifications' + If (!(Test-Path $Live)) { + mkdir $Live + New-ItemProperty $Live NoTileApplicationNotification -Value 1 + } + + #Turns off Data Collection via the AllowTelemtry key by changing it to 0 + Write-Host "Turning off Data Collection" + $DataCollection = 'HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\Policies\DataCollection' + If (Test-Path $DataCollection) { + Set-ItemProperty $DataCollection AllowTelemetry -Value 0 + } + + #Disables People icon on Taskbar + Write-Host "Disabling People icon on Taskbar" + $People = 'HKCU:\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\Advanced\People' + If (Test-Path $People) { + Set-ItemProperty $People PeopleBand -Value 0 + } + + #Disables suggestions on start menu + Write-Host "Disabling suggestions on the Start Menu" + $Suggestions = 'HKCU:\Software\Microsoft\Windows\CurrentVersion\ContentDeliveryManager' + If (Test-Path $Suggestions) { + Set-ItemProperty $Suggestions SystemPaneSuggestionsEnabled -Value 0 + } + + + Write-Host "Removing CloudStore from registry if it exists" + $CloudStore = 'HKCUSoftware\Microsoft\Windows\CurrentVersion\CloudStore' + If (Test-Path $CloudStore) { + Stop-Process Explorer.exe -Force + Remove-Item $CloudStore + Start-Process Explorer.exe -Wait + } + + #Loads the registry keys/values below into the NTUSER.DAT file which prevents the apps from redownloading. Credit to a60wattfish + reg load HKU\Default_User C:\Users\Default\NTUSER.DAT + Set-ItemProperty -Path Registry::HKU\Default_User\SOFTWARE\Microsoft\Windows\CurrentVersion\ContentDeliveryManager -Name SystemPaneSuggestionsEnabled -Value 0 + Set-ItemProperty -Path Registry::HKU\Default_User\SOFTWARE\Microsoft\Windows\CurrentVersion\ContentDeliveryManager -Name PreInstalledAppsEnabled -Value 0 + Set-ItemProperty -Path Registry::HKU\Default_User\SOFTWARE\Microsoft\Windows\CurrentVersion\ContentDeliveryManager -Name OemPreInstalledAppsEnabled -Value 0 + reg unload HKU\Default_User + + #Disables scheduled tasks that are considered unnecessary + Write-Host "Disabling scheduled tasks" + #Get-ScheduledTask -TaskName XblGameSaveTaskLogon | Disable-ScheduledTask + Get-ScheduledTask -TaskName XblGameSaveTask | Disable-ScheduledTask + Get-ScheduledTask -TaskName Consolidator | Disable-ScheduledTask + Get-ScheduledTask -TaskName UsbCeip | Disable-ScheduledTask + Get-ScheduledTask -TaskName DmClient | Disable-ScheduledTask + Get-ScheduledTask -TaskName DmClientOnScenarioDownload | Disable-ScheduledTask + } + ProtectPrivacy }) From 030bec1017224ad5483566700c97d9d9cbeacdc5 Mon Sep 17 00:00:00 2001 From: Richard Newton Date: Sat, 5 Sep 2020 23:42:13 -0400 Subject: [PATCH 10/15] Created W10DebloaterGUI.ps1 This will be the newer version going forward. Any feedback is appreciated. This is still in development. --- W10DebloaterGUI.ps1 | 264 ++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 264 insertions(+) create mode 100644 W10DebloaterGUI.ps1 diff --git a/W10DebloaterGUI.ps1 b/W10DebloaterGUI.ps1 new file mode 100644 index 00000000..322daf5f --- /dev/null +++ b/W10DebloaterGUI.ps1 @@ -0,0 +1,264 @@ +<# This form was created using POSHGUI.com a free online gui designer for PowerShell +.NAME + Untitled +#> + +#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. + +<#$ErrorActionPreference = 'SilentlyContinue' + +$Button = [System.Windows.MessageBoxButton]::YesNoCancel +$ErrorIco = [System.Windows.MessageBoxImage]::Error +$Ask = 'Do you want to run this as an Administrator? + + Select "Yes" to Run as an Administrator + + Select "No" to not run this as an Administrator + + Select "Cancel" to stop the script.' + +If (!([Security.Principal.WindowsPrincipal][Security.Principal.WindowsIdentity]::GetCurrent()).IsInRole([Security.Principal.WindowsBuiltInRole]'Administrator')) { + $Prompt = [System.Windows.MessageBox]::Show($Ask, "Run as an Administrator or not?", $Button, $ErrorIco) + Switch ($Prompt) { + #This will debloat Windows 10 + Yes { + Write-Host "You didn't run this script as an Administrator. This script will self elevate to run as an Administrator and continue." + Start-Process PowerShell.exe -ArgumentList ("-NoProfile -ExecutionPolicy Bypass -File `"{0}`"" -f $PSCommandPath) -Verb RunAs + Exit + } + No { + Break + } + } +}#> + +$DebloatFolder = "C:\Temp\Windows10Debloater" +If (Test-Path $DebloatFolder) { + Write-Host "${DebloatFolder} exists." + + Remove-Item -name +} +Else { + Write-Host "The folder ${DebloatFolder} doesn't exist. This folder will be used for storing logs created after the script runs. Creating now." + Start-Sleep 1 + New-Item -Path "${DebloatFolder}" -ItemType Directory + Write-Host "The folder ${DebloatFolder} was successfully created." +} + +Start-Transcript -OutputDirectory "${DebloatFolder}" + +Add-Type -AssemblyName System.Windows.Forms +[System.Windows.Forms.Application]::EnableVisualStyles() + +$Form = New-Object system.Windows.Forms.Form +$Form.ClientSize = '875,616' +$Form.text = "Windows 10 Debloater" +$Form.TopMost = $false + +$ListBox1 = New-Object system.Windows.Forms.ListBox +$ListBox1.text = "listBox" +$ListBox1.width = 300 +$ListBox1.height = 494 +$ListBox1.location = New-Object System.Drawing.Point(3, 116) +$ListBox1.SelectionMode = 'MultiExtended' + + +$TextBox1 = New-Object system.Windows.Forms.RichTextBox +$TextBox1.multiline = $True +$TextBox1.width = 535 +$TextBox1.height = 400 +$TextBox1.location = New-Object System.Drawing.Point(325, 200) +$TextBox1.Font = 'Microsoft Sans Serif,10' + + +$Button1 = New-Object system.Windows.Forms.Button +$Button1.text = "Uninstall" +$Button1.width = 80 +$Button1.height = 30 +$Button1.location = New-Object System.Drawing.Point(5, 80) +$Button1.Font = 'Microsoft Sans Serif,10' + +$Button2 = New-Object system.Windows.Forms.Button +$Button2.text = "Apply Checkbox Changes" +$Button2.width = 175 +$Button2.height = 30 +$Button2.location = New-Object System.Drawing.Point(685, 165) +$Button2.Font = 'Microsoft Sans Serif,10' + +$Label1 = New-Object system.Windows.Forms.Label +$Label1.text = "-----------------------------------------------------------------------------------------------------------------" +$Label1.AutoSize = $true +$Label1.width = 50 +$Label1.height = 10 +$Label1.location = New-Object System.Drawing.Point(305,108) +$Label1.Font = New-Object System.Drawing.Font('Microsoft Sans Serif',10) + +$CheckBox1 = New-Object system.Windows.Forms.CheckBox +$CheckBox1.text = "Enable Cortana" +$CheckBox1.AutoSize = $false +$CheckBox1.width = 125 +$CheckBox1.height = 20 +$CheckBox1.location = New-Object System.Drawing.Point(325,175) +$CheckBox1.Font = New-Object System.Drawing.Font('Microsoft Sans Serif',10) + +$CheckBox2 = New-Object system.Windows.Forms.CheckBox +$CheckBox2.text = "Disable Cortana" +$CheckBox2.AutoSize = $false +$CheckBox2.width = 125 +$CheckBox2.height = 20 +$CheckBox2.location = New-Object System.Drawing.Point(325,150) +$CheckBox2.Font = New-Object System.Drawing.Font('Microsoft Sans Serif',10) + +$CheckBox3 = New-Object system.Windows.Forms.CheckBox +$CheckBox3.text = "Uninstall OneDrive" +$CheckBox3.AutoSize = $false +$CheckBox3.width = 140 +$CheckBox3.height = 20 +$CheckBox3.location = New-Object System.Drawing.Point(475,150) +$CheckBox3.Font = New-Object System.Drawing.Font('Microsoft Sans Serif',10) + +$CheckBox4 = New-Object system.Windows.Forms.CheckBox +$CheckBox4.text = "Unpin Tiles From Start Menu" +$CheckBox4.AutoSize = $false +$CheckBox4.width = 200 +$CheckBox4.height = 20 +$CheckBox4.location = New-Object System.Drawing.Point(475,175) +$CheckBox4.Font = New-Object System.Drawing.Font('Microsoft Sans Serif',10) + + +$Form.controls.AddRange(@($ListBox1, $Button1, $Button2, $TextBox1, $CustomizeBlacklists, $CustomizeForm, $SaveList, $CustomizeBlacklists, $Checkbox1, $Checkbox2, $CheckBox3, $CheckBox4, $Label1)) + +$global:Bloatware = @( + "Microsoft.PPIProjection" + "Microsoft.BingNews" + "Microsoft.GetHelp" + "Microsoft.Getstarted" + "Microsoft.Messaging" + "Microsoft.Microsoft3DViewer" + "Microsoft.MicrosoftOfficeHub" + "Microsoft.MicrosoftSolitaireCollection" + "Microsoft.NetworkSpeedTest" + "Microsoft.News" # Issue 77 + "Microsoft.Office.Lens" # Issue 77 + "Microsoft.Office.OneNote" + "Microsoft.Office.Sway" + "Microsoft.OneConnect" + "Microsoft.People" + "Microsoft.Print3D" + "Microsoft.RemoteDesktop" # Issue 120 + "Microsoft.SkypeApp" + "Microsoft.StorePurchaseApp" + "Microsoft.Office.Todo.List" # Issue 77 + "Microsoft.Whiteboard" # Issue 77 + "Microsoft.WindowsAlarms" + "microsoft.windowscommunicationsapps" + "Microsoft.WindowsFeedbackHub" + "Microsoft.WindowsMaps" + "Microsoft.WindowsSoundRecorder" + "Microsoft.Xbox.TCUI" + "Microsoft.XboxApp" + "Microsoft.XboxGameOverlay" + "Microsoft.XboxGamingOverlay" + "Microsoft.XboxIdentityProvider" + "Microsoft.XboxSpeechToTextOverlay" + "Microsoft.ZuneMusic" + "Microsoft.ZuneVideo" + + #Sponsored Windows 10 AppX Apps + #Add sponsored/featured apps to remove in the "*AppName*" format + "EclipseManager" + "ActiproSoftwareLLC" + "AdobeSystemsIncorporated.AdobePhotoshopExpress" + "Duolingo-LearnLanguagesforFree" + "PandoraMediaInc" + "CandyCrush" + "BubbleWitch3Saga" + "Wunderlist" + "Flipboard" + "Twitter" + "Facebook" + "Spotify" # Issue 123 + "Minecraft" + "Royal Revolt" + "Sway" # Issue 77 + "Dolby" # Issue 78 + + #Optional: Typically not removed but you can if you need to for some reason + #"Microsoft.Advertising.Xaml_10.1712.5.0_x64__8wekyb3d8bbwe" + #"Microsoft.Advertising.Xaml_10.1712.5.0_x86__8wekyb3d8bbwe" + #"Microsoft.BingWeather" +) + +#$Windows10AppsFolder = Get-Item -path "C:\Program Files\WindowsApps\*" +foreach ($Bloat in $Bloatware) { + + #$Apps = $App.Trim("C:\Program Files\WindowsApps\") + $ListBox1.Items.Add($Bloat) + $ListBox1.Sorted = $True + +} + +$SelectedBloatware = $ListBox1.SelectedItems +$Button1.Add_Click( { + + + ForEach ($Selected in $SelectedBloatware) { + $TextBox1.AppendText("Trying to remove $Selected... +") + + Try { + If (Test-Path "C:\Program Files\WindowsApps\*$Selected*") { + Get-AppxPackage | Where-Object { ($_.Name -match $Selected) } | Remove-AppxPackage + Get-AppxProvisionedPackage -Online | Where-Object { ($_.Name -match $Selected) } | Remove-AppxProvisionedPackage -Online + Get-AppxPackage -AllUsers | Where-Object { ($_.Name -match $Selected) } | Remove-AppxPackage + + $TextBox1.AppendText("Successfully removed $Selected! + +") +} + Else { + + If (!(Test-Path "C:\Program Files\WindowsApps\*$Selected*")) { + $TextBox1.AppendText("$Selected doesn't exist on this machine! + +") + } + + } + + } + + Catch { + $TextBox1.AppendText("$_") + + } + } + +} ) + +<#$CheckBox1.Add_CheckedChanged( { + + #Enables Cortana to be used as part of your Windows Search Function + $Textbox1.AppendText("Re-enabling Cortana to be used in your Windows Search") + $Search = "HKLM:\SOFTWARE\Policies\Microsoft\Windows\Windows Search" + If (Test-Path $Search) { + Set-ItemProperty $Search AllowCortana -Value 1 + } + +} ) #> + +$Button2.Add_Click( { + + If ($CheckBox1.Checked) { + + $Textbox1.AppendText("Re-enabling Cortana to be used in your Windows Search") + $Search = "HKLM:\SOFTWARE\Policies\Microsoft\Windows\Windows Search" + If (Test-Path $Search) { + Set-ItemProperty $Search AllowCortana -Value 1 + } + + } + +} ) + +[void]$Form.ShowDialog() From 70054bbb66e23ba0fd0d5ae53b1b2f2e213f7313 Mon Sep 17 00:00:00 2001 From: Richard Newton Date: Sat, 5 Sep 2020 23:57:28 -0400 Subject: [PATCH 11/15] Added checkbox code --- W10DebloaterGUI.ps1 | 215 ++++++++++++++++++++++++++++++++------------ 1 file changed, 156 insertions(+), 59 deletions(-) diff --git a/W10DebloaterGUI.ps1 b/W10DebloaterGUI.ps1 index 322daf5f..bd9c050b 100644 --- a/W10DebloaterGUI.ps1 +++ b/W10DebloaterGUI.ps1 @@ -35,8 +35,6 @@ If (!([Security.Principal.WindowsPrincipal][Security.Principal.WindowsIdentity]: $DebloatFolder = "C:\Temp\Windows10Debloater" If (Test-Path $DebloatFolder) { Write-Host "${DebloatFolder} exists." - - Remove-Item -name } Else { Write-Host "The folder ${DebloatFolder} doesn't exist. This folder will be used for storing logs created after the script runs. Creating now." @@ -85,45 +83,45 @@ $Button2.height = 30 $Button2.location = New-Object System.Drawing.Point(685, 165) $Button2.Font = 'Microsoft Sans Serif,10' -$Label1 = New-Object system.Windows.Forms.Label -$Label1.text = "-----------------------------------------------------------------------------------------------------------------" -$Label1.AutoSize = $true -$Label1.width = 50 -$Label1.height = 10 -$Label1.location = New-Object System.Drawing.Point(305,108) -$Label1.Font = New-Object System.Drawing.Font('Microsoft Sans Serif',10) - -$CheckBox1 = New-Object system.Windows.Forms.CheckBox -$CheckBox1.text = "Enable Cortana" -$CheckBox1.AutoSize = $false -$CheckBox1.width = 125 -$CheckBox1.height = 20 -$CheckBox1.location = New-Object System.Drawing.Point(325,175) -$CheckBox1.Font = New-Object System.Drawing.Font('Microsoft Sans Serif',10) - -$CheckBox2 = New-Object system.Windows.Forms.CheckBox -$CheckBox2.text = "Disable Cortana" -$CheckBox2.AutoSize = $false -$CheckBox2.width = 125 -$CheckBox2.height = 20 -$CheckBox2.location = New-Object System.Drawing.Point(325,150) -$CheckBox2.Font = New-Object System.Drawing.Font('Microsoft Sans Serif',10) - -$CheckBox3 = New-Object system.Windows.Forms.CheckBox -$CheckBox3.text = "Uninstall OneDrive" -$CheckBox3.AutoSize = $false -$CheckBox3.width = 140 -$CheckBox3.height = 20 -$CheckBox3.location = New-Object System.Drawing.Point(475,150) -$CheckBox3.Font = New-Object System.Drawing.Font('Microsoft Sans Serif',10) - -$CheckBox4 = New-Object system.Windows.Forms.CheckBox -$CheckBox4.text = "Unpin Tiles From Start Menu" -$CheckBox4.AutoSize = $false -$CheckBox4.width = 200 -$CheckBox4.height = 20 -$CheckBox4.location = New-Object System.Drawing.Point(475,175) -$CheckBox4.Font = New-Object System.Drawing.Font('Microsoft Sans Serif',10) +$Label1 = New-Object system.Windows.Forms.Label +$Label1.text = "-----------------------------------------------------------------------------------------------------------------" +$Label1.AutoSize = $true +$Label1.width = 50 +$Label1.height = 10 +$Label1.location = New-Object System.Drawing.Point(305, 108) +$Label1.Font = New-Object System.Drawing.Font('Microsoft Sans Serif', 10) + +$CheckBox1 = New-Object system.Windows.Forms.CheckBox +$CheckBox1.text = "Enable Cortana" +$CheckBox1.AutoSize = $false +$CheckBox1.width = 125 +$CheckBox1.height = 20 +$CheckBox1.location = New-Object System.Drawing.Point(325, 175) +$CheckBox1.Font = New-Object System.Drawing.Font('Microsoft Sans Serif', 10) + +$CheckBox2 = New-Object system.Windows.Forms.CheckBox +$CheckBox2.text = "Disable Cortana" +$CheckBox2.AutoSize = $false +$CheckBox2.width = 125 +$CheckBox2.height = 20 +$CheckBox2.location = New-Object System.Drawing.Point(325, 150) +$CheckBox2.Font = New-Object System.Drawing.Font('Microsoft Sans Serif', 10) + +$CheckBox3 = New-Object system.Windows.Forms.CheckBox +$CheckBox3.text = "Uninstall OneDrive" +$CheckBox3.AutoSize = $false +$CheckBox3.width = 140 +$CheckBox3.height = 20 +$CheckBox3.location = New-Object System.Drawing.Point(475, 150) +$CheckBox3.Font = New-Object System.Drawing.Font('Microsoft Sans Serif', 10) + +$CheckBox4 = New-Object system.Windows.Forms.CheckBox +$CheckBox4.text = "Unpin Tiles From Start Menu" +$CheckBox4.AutoSize = $false +$CheckBox4.width = 200 +$CheckBox4.height = 20 +$CheckBox4.location = New-Object System.Drawing.Point(475, 175) +$CheckBox4.Font = New-Object System.Drawing.Font('Microsoft Sans Serif', 10) $Form.controls.AddRange(@($ListBox1, $Button1, $Button2, $TextBox1, $CustomizeBlacklists, $CustomizeForm, $SaveList, $CustomizeBlacklists, $Checkbox1, $Checkbox2, $CheckBox3, $CheckBox4, $Label1)) @@ -215,7 +213,7 @@ $Button1.Add_Click( { $TextBox1.AppendText("Successfully removed $Selected! ") -} + } Else { If (!(Test-Path "C:\Program Files\WindowsApps\*$Selected*")) { @@ -234,31 +232,130 @@ $Button1.Add_Click( { } } -} ) + } ) + -<#$CheckBox1.Add_CheckedChanged( { +$Button2.Add_Click( { - #Enables Cortana to be used as part of your Windows Search Function - $Textbox1.AppendText("Re-enabling Cortana to be used in your Windows Search") - $Search = "HKLM:\SOFTWARE\Policies\Microsoft\Windows\Windows Search" - If (Test-Path $Search) { - Set-ItemProperty $Search AllowCortana -Value 1 + If ($CheckBox1.Checked) { + + $Textbox1.AppendText("Re-enabling Cortana to be used in your Windows Search") + $Search = "HKLM:\SOFTWARE\Policies\Microsoft\Windows\Windows Search" + If (Test-Path $Search) { + Set-ItemProperty $Search AllowCortana -Value 1 + } + } -} ) #> + If ($CheckBox2.Checked) { + + Write-Host "Stopping Cortana from being used as part of your Windows Search Function" + $Search = 'HKLM:\SOFTWARE\Policies\Microsoft\Windows\Windows Search' + If (Test-Path $Search) { + Set-ItemProperty $Search AllowCortana -Value 0 + } + } -$Button2.Add_Click( { + If ($CheckBox3.Checked) { + + $RemoveOnedrive.Add_Click( { + If (Test-Path "$env:USERPROFILE\OneDrive\*") { + Write-Host "Files found within the OneDrive folder! Checking to see if a folder named OneDriveBackupFiles exists." + Start-Sleep 1 + + If (Test-Path "$env:USERPROFILE\Desktop\OneDriveBackupFiles") { + Write-Host "A folder named OneDriveBackupFiles already exists on your desktop. All files from your OneDrive location will be moved to that folder." + } + else { + If (!(Test-Path "$env:USERPROFILE\Desktop\OneDriveBackupFiles")) { + 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." + New-item -Path "$env:USERPROFILE\Desktop" -Name "OneDriveBackupFiles"-ItemType Directory -Force + Write-Host "Successfully created the folder 'OneDriveBackupFiles' on your desktop." + } + } + Start-Sleep 1 + Move-Item -Path "$env:USERPROFILE\OneDrive\*" -Destination "$env:USERPROFILE\Desktop\OneDriveBackupFiles" -Force + Write-Host "Successfully moved all files/folders from your OneDrive folder to the folder 'OneDriveBackupFiles' on your desktop." + Start-Sleep 1 + Write-Host "Proceeding with the removal of OneDrive." + Start-Sleep 1 + } + Else { + 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." + Start-Sleep 1 + Write-Host "Enabling the Group Policy 'Prevent the usage of OneDrive for File Storage'." + $OneDriveKey = 'HKLM:Software\Policies\Microsoft\Windows\OneDrive' + If (!(Test-Path $OneDriveKey)) { + Mkdir $OneDriveKey + Set-ItemProperty $OneDriveKey -Name OneDrive -Value DisableFileSyncNGSC + } + Set-ItemProperty $OneDriveKey -Name OneDrive -Value DisableFileSyncNGSC + } - If ($CheckBox1.Checked) { + Write-Host "Uninstalling OneDrive. Please wait..." - $Textbox1.AppendText("Re-enabling Cortana to be used in your Windows Search") - $Search = "HKLM:\SOFTWARE\Policies\Microsoft\Windows\Windows Search" - If (Test-Path $Search) { - Set-ItemProperty $Search AllowCortana -Value 1 - } + New-PSDrive HKCR -PSProvider Registry -Root HKEY_CLASSES_ROOT + $onedrive = "$env:SYSTEMROOT\SysWOW64\OneDriveSetup.exe" + $ExplorerReg1 = "HKCR:\CLSID\{018D5C66-4533-4307-9B53-224DE2ED1FE6}" + $ExplorerReg2 = "HKCR:\Wow6432Node\CLSID\{018D5C66-4533-4307-9B53-224DE2ED1FE6}" + Stop-Process -Name "OneDrive*" + Start-Sleep 2 + If (!(Test-Path $onedrive)) { + $onedrive = "$env:SYSTEMROOT\System32\OneDriveSetup.exe" + } + Start-Process $onedrive "/uninstall" -NoNewWindow -Wait + Start-Sleep 2 + Write-Host "Stopping explorer" + Start-Sleep 1 + taskkill.exe /F /IM explorer.exe + Start-Sleep 3 + Write-Host "Removing leftover files" + If (Test-Path "$env:USERPROFILE\OneDrive") { + Remove-Item "$env:USERPROFILE\OneDrive" -Force -Recurse + } + If (Test-Path "$env:LOCALAPPDATA\Microsoft\OneDrive") { + Remove-Item "$env:LOCALAPPDATA\Microsoft\OneDrive" -Force -Recurse + } + If (Test-Path "$env:PROGRAMDATA\Microsoft OneDrive") { + Remove-Item "$env:PROGRAMDATA\Microsoft OneDrive" -Force -Recurse + } + If (Test-Path "$env:SYSTEMDRIVE\OneDriveTemp") { + Remove-Item "$env:SYSTEMDRIVE\OneDriveTemp" -Force -Recurse + } + Write-Host "Removing OneDrive from windows explorer" + If (!(Test-Path $ExplorerReg1)) { + New-Item $ExplorerReg1 + } + Set-ItemProperty $ExplorerReg1 System.IsPinnedToNameSpaceTree -Value 0 + If (!(Test-Path $ExplorerReg2)) { + New-Item $ExplorerReg2 + } + Set-ItemProperty $ExplorerReg2 System.IsPinnedToNameSpaceTree -Value 0 + Write-Host "Restarting Explorer that was shut down before." + Start-Process explorer.exe -NoNewWindow + Write-Host "OneDrive has been successfully uninstalled!" + + Remove-item env:OneDrive + }) - } + + } + + If ($CheckBox4.Checked) { + + #Credit to Vikingat-Rage + #https://superuser.com/questions/1068382/how-to-remove-all-the-tiles-in-the-windows-10-start-menu + #Unpins all tiles from the Start Menu + Write-Host "Unpinning all tiles from the start menu" + (New-Object -Com Shell.Application). + NameSpace('shell:::{4234d49b-0245-4df3-b780-3893943456e1}'). + Items() | + % { $_.Verbs() } | + ? { $_.Name -match 'Un.*pin from Start' } | + % { $_.DoIt() } + + } -} ) + } ) [void]$Form.ShowDialog() From e8c527ee78f96a984f0767413355ac9f5893487c Mon Sep 17 00:00:00 2001 From: Richard Newton Date: Sun, 6 Sep 2020 00:19:50 -0400 Subject: [PATCH 12/15] Added system restore creation option --- W10DebloaterGUI.ps1 | 29 +++++++++++++++++++++++++++++ 1 file changed, 29 insertions(+) diff --git a/W10DebloaterGUI.ps1 b/W10DebloaterGUI.ps1 index bd9c050b..497eb0a6 100644 --- a/W10DebloaterGUI.ps1 +++ b/W10DebloaterGUI.ps1 @@ -46,6 +46,7 @@ Else { Start-Transcript -OutputDirectory "${DebloatFolder}" Add-Type -AssemblyName System.Windows.Forms +Add-Type -AssemblyName PresentationCore, PresentationFramework [System.Windows.Forms.Application]::EnableVisualStyles() $Form = New-Object system.Windows.Forms.Form @@ -196,8 +197,28 @@ foreach ($Bloat in $Bloatware) { } +$Button = [Windows.MessageBoxButton]::YesNoCancel +$ErrorIco = [Windows.MessageBoxImage]::Error +$Warn = [Windows.MessageBoxImage]::Warning + +$Ask = 'Do you want to create a System Restore Point? + Select "Yes" to create a System Restore Point + Select "No" to not create a System Restore Point + + Select "Cancel" to stop the script.' + + $SelectedBloatware = $ListBox1.SelectedItems $Button1.Add_Click( { + +$Prompt1 = [Windows.MessageBox]::Show($Ask, "Create a System Restore Point?", $Button, $ErrorIco) +Switch ($Prompt1) { + Yes { +$TextBox1.AppendText("Creating System Restore point. Please wait... + +") +Checkpoint-Computer -Description "Install MyApp" -Verbose + ForEach ($Selected in $SelectedBloatware) { @@ -232,6 +253,14 @@ $Button1.Add_Click( { } } + } + + No { + + Break + + } + } } ) From bf6cf0ad950cd50ec0ad7fa8208dc777704d034a Mon Sep 17 00:00:00 2001 From: Richard Newton Date: Sun, 6 Sep 2020 00:20:15 -0400 Subject: [PATCH 13/15] Removed Windows10DebloaterGUI --- Windows10DebloaterGUI.ps1 | 325 -------------------------------------- 1 file changed, 325 deletions(-) delete mode 100644 Windows10DebloaterGUI.ps1 diff --git a/Windows10DebloaterGUI.ps1 b/Windows10DebloaterGUI.ps1 deleted file mode 100644 index 52c87b90..00000000 --- a/Windows10DebloaterGUI.ps1 +++ /dev/null @@ -1,325 +0,0 @@ -Add-Type -AssemblyName System.Windows.Forms -Add-Type -AssemblyName System.Drawing - -$ErrorPreference = 'SilentlyContinue' -$VerbosePreference = 'Continue' - -$form = New-Object System.Windows.Forms.Form -$form.Text = 'Windows10Debloater' -$form.Size = New-Object System.Drawing.Size(800,600) -$form.StartPosition = 'CenterScreen' - -$OKButton = New-Object System.Windows.Forms.Button -$OKButton.Location = New-Object System.Drawing.Point(275,40) -$OKButton.Size = New-Object System.Drawing.Size(225,23) -$OKButton.Text = 'Remove Selected Bloatware Packages' -$OKButton.DialogResult = [System.Windows.Forms.DialogResult]::OK -$form.AcceptButton = $OKButton -$form.Controls.Add($OKButton) - -$RemoveKeys = New-Object system.Windows.Forms.Button -$RemoveKeys.text = "Remove registry keys associated with Bloatware" -$RemoveKeys.width = 265 -$RemoveKeys.height = 23 -$RemoveKeys.location = New-Object System.Drawing.Point(275,400) -$form.Controls.Add($RemoveKeys) -#$WhitelistDebloat.Font = 'Microsoft Sans Serif,10' - -$ProtectPrivacy = New-Object system.Windows.Forms.Button -$ProtectPrivacy.text = "Disable Telemetry" -$ProtectPrivacy.width = 265 -$ProtectPrivacy.height = 23 -$ProtectPrivacy.location = New-Object System.Drawing.Point(275,365) -$form.Controls.Add($ProtectPrivacy) -#$WhitelistDebloat.Font = 'Microsoft Sans Serif,10' - -$label = New-Object System.Windows.Forms.Label -$label.Location = New-Object System.Drawing.Point(10,20) -$label.Size = New-Object System.Drawing.Size(280,20) -$label.Text = 'Select Default Bloatware Packages To Remove:' -$form.Controls.Add($label) - -$listBox = New-Object System.Windows.Forms.ListBox -$listBox.Location = New-Object System.Drawing.Point(10,40) -$listBox.Size = New-Object System.Drawing.Size(260,500) -#$listBox.Height = 80 - -$label2 = New-Object System.Windows.Forms.Label -$label2.Location = New-Object System.Drawing.Point(275,145) -$label2.Size = New-Object System.Drawing.Size(280,30) -$label2.Text = 'This is used to remove other packages besides the ones chosen on the left hand side' -$form.Controls.Add($label2) - -$label3 = New-Object System.Windows.Forms.Label -$label3.Location = New-Object System.Drawing.Point(275,285) -$label3.Size = New-Object System.Drawing.Size(500,15) -$label3.Text = '_______________________________________________________________________________' -$form.Controls.Add($label3) - -$label4 = New-Object System.Windows.Forms.Label -$label4.Location = New-Object System.Drawing.Point(275,265) -$label4.Size = New-Object System.Drawing.Size(500,100) -$label4.Text = 'ADVANCED OPTIONS BELOW' -$form.Controls.Add($label4) - -$WhitelistDebloat = New-Object system.Windows.Forms.Button -$WhitelistDebloat.text = "Remove extra packages besides the default bloatware" -$WhitelistDebloat.width = 285 -$WhitelistDebloat.height = 30 -$WhitelistDebloat.location = New-Object System.Drawing.Point(275,175) -#$WhitelistDebloat.Font = 'Microsoft Sans Serif,10' - -$Form.controls.AddRange(@($WhitelistDebloat,$RemoveKeys,$ProtectPrivacy)) - -$WhitelistDebloat.Add_Click({ -Function DebloatAll { - #Removes AppxPackages - #Credit to /u/GavinEke for a modified version of my whitelist code - $WhitelistedApps = 'Microsoft.ScreenSketch|Microsoft.Paint3D|Microsoft.WindowsCalculator|Microsoft.WindowsStore|Microsoft.Windows.Photos|CanonicalGroupLimited.UbuntuonWindows|` - Microsoft.XboxGameCallableUI|Microsoft.XboxGamingOverlay|Microsoft.Xbox.TCUI|Microsoft.XboxGamingOverlay|Microsoft.XboxIdentityProvider|Microsoft.MicrosoftStickyNotes|Microsoft.MSPaint|Microsoft.WindowsCamera|.NET|Framework|` - Microsoft.HEIFImageExtension|Microsoft.ScreenSketch|Microsoft.StorePurchaseApp|Microsoft.VP9VideoExtensions|Microsoft.WebMediaExtensions|Microsoft.WebpImageExtension|Microsoft.DesktopAppInstaller|WindSynthBerry|MIDIBerry|Slack' - #NonRemovable Apps that where getting attempted and the system would reject the uninstall, speeds up debloat and prevents 'initalizing' overlay when removing apps - $NonRemovable = '1527c705-839a-4832-9118-54d4Bd6a0c89|c5e2524a-ea46-4f67-841f-6a9465d9d515|E2A4F912-2574-4A75-9BB0-0D023378592B|F46D4000-FD22-4DB4-AC8E-4E1DDDE828FE|InputApp|Microsoft.AAD.BrokerPlugin|Microsoft.AccountsControl|` - Microsoft.BioEnrollment|Microsoft.CredDialogHost|Microsoft.ECApp|Microsoft.LockApp|Microsoft.MicrosoftEdgeDevToolsClient|Microsoft.MicrosoftEdge|Microsoft.PPIProjection|Microsoft.Win32WebViewHost|Microsoft.Windows.Apprep.ChxApp|` - Microsoft.Windows.AssignedAccessLockApp|Microsoft.Windows.CapturePicker|Microsoft.Windows.CloudExperienceHost|Microsoft.Windows.ContentDeliveryManager|Microsoft.Windows.Cortana|Microsoft.Windows.NarratorQuickStart|` - Microsoft.Windows.ParentalControls|Microsoft.Windows.PeopleExperienceHost|Microsoft.Windows.PinningConfirmationDialog|Microsoft.Windows.SecHealthUI|Microsoft.Windows.SecureAssessmentBrowser|Microsoft.Windows.ShellExperienceHost|` - Microsoft.Windows.XGpuEjectDialog|Microsoft.XboxGameCallableUI|Windows.CBSPreview|windows.immersivecontrolpanel|Windows.PrintDialog|Microsoft.VCLibs.140.00|Microsoft.Services.Store.Engagement|Microsoft.UI.Xaml.2.0' - Get-AppxPackage -AllUsers | Where {$_.Name -NotMatch $WhitelistedApps -and $_.Name -NotMatch $NonRemovable} | Remove-AppxPackage - Get-AppxPackage | Where {$_.Name -NotMatch $WhitelistedApps -and $_.Name -NotMatch $NonRemovable} | Remove-AppxPackage - Get-AppxProvisionedPackage -Online | Where {$_.Name -NotMatch $WhitelistedApps -and $_.Name -NotMatch $NonRemovable} | Remove-AppxProvisionedPackage -Online -} - -Debloatall - - }) - - New-PSDrive -Name HKCR -PSProvider Registry -Root HKEY_CLASSES_ROOT - $RemoveKeys.Add_Click({ - Function Remove-Keys { - - New-PSDrive -Name HKCR -PSProvider Registry -Root HKEY_CLASSES_ROOT - - #These are the registry keys that it will delete. - - $Keys = @( - - #Remove Background Tasks - "HKCR:\Extensions\ContractId\Windows.BackgroundTasks\PackageId\46928bounde.EclipseManager_2.2.4.51_neutral__a5h4egax66k6y" - "HKCR:\Extensions\ContractId\Windows.BackgroundTasks\PackageId\ActiproSoftwareLLC.562882FEEB491_2.6.18.18_neutral__24pqs290vpjk0" - "HKCR:\Extensions\ContractId\Windows.BackgroundTasks\PackageId\Microsoft.MicrosoftOfficeHub_17.7909.7600.0_x64__8wekyb3d8bbwe" - "HKCR:\Extensions\ContractId\Windows.BackgroundTasks\PackageId\Microsoft.PPIProjection_10.0.15063.0_neutral_neutral_cw5n1h2txyewy" - "HKCR:\Extensions\ContractId\Windows.BackgroundTasks\PackageId\Microsoft.XboxGameCallableUI_1000.15063.0.0_neutral_neutral_cw5n1h2txyewy" - "HKCR:\Extensions\ContractId\Windows.BackgroundTasks\PackageId\Microsoft.XboxGameCallableUI_1000.16299.15.0_neutral_neutral_cw5n1h2txyewy" - - #Windows File - "HKCR:\Extensions\ContractId\Windows.File\PackageId\ActiproSoftwareLLC.562882FEEB491_2.6.18.18_neutral__24pqs290vpjk0" - - #Registry keys to delete if they aren't uninstalled by RemoveAppXPackage/RemoveAppXProvisionedPackage - "HKCR:\Extensions\ContractId\Windows.Launch\PackageId\46928bounde.EclipseManager_2.2.4.51_neutral__a5h4egax66k6y" - "HKCR:\Extensions\ContractId\Windows.Launch\PackageId\ActiproSoftwareLLC.562882FEEB491_2.6.18.18_neutral__24pqs290vpjk0" - "HKCR:\Extensions\ContractId\Windows.Launch\PackageId\Microsoft.PPIProjection_10.0.15063.0_neutral_neutral_cw5n1h2txyewy" - "HKCR:\Extensions\ContractId\Windows.Launch\PackageId\Microsoft.XboxGameCallableUI_1000.15063.0.0_neutral_neutral_cw5n1h2txyewy" - "HKCR:\Extensions\ContractId\Windows.Launch\PackageId\Microsoft.XboxGameCallableUI_1000.16299.15.0_neutral_neutral_cw5n1h2txyewy" - - #Scheduled Tasks to delete - "HKCR:\Extensions\ContractId\Windows.PreInstalledConfigTask\PackageId\Microsoft.MicrosoftOfficeHub_17.7909.7600.0_x64__8wekyb3d8bbwe" - - #Windows Protocol Keys - "HKCR:\Extensions\ContractId\Windows.Protocol\PackageId\ActiproSoftwareLLC.562882FEEB491_2.6.18.18_neutral__24pqs290vpjk0" - "HKCR:\Extensions\ContractId\Windows.Protocol\PackageId\Microsoft.PPIProjection_10.0.15063.0_neutral_neutral_cw5n1h2txyewy" - "HKCR:\Extensions\ContractId\Windows.Protocol\PackageId\Microsoft.XboxGameCallableUI_1000.15063.0.0_neutral_neutral_cw5n1h2txyewy" - "HKCR:\Extensions\ContractId\Windows.Protocol\PackageId\Microsoft.XboxGameCallableUI_1000.16299.15.0_neutral_neutral_cw5n1h2txyewy" - - #Windows Share Target - "HKCR:\Extensions\ContractId\Windows.ShareTarget\PackageId\ActiproSoftwareLLC.562882FEEB491_2.6.18.18_neutral__24pqs290vpjk0" - ) - - #This writes the output of each key it is removing and also removes the keys listed above. - ForEach ($Key in $Keys) { - Write-Verbose "Removing $Key from registry" - Remove-Item $Key -Recurse - } -} -Remove-Keys -}) - -$ProtectPrivacy.Add_Click({ -Function ProtectPrivacy { - - #Creates a PSDrive to be able to access the 'HKCR' tree - New-PSDrive -Name HKCR -PSProvider Registry -Root HKEY_CLASSES_ROOT - - #Disables Windows Feedback Experience - Write-Host "Disabling Windows Feedback Experience program" - $Advertising = 'HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\AdvertisingInfo' - If (Test-Path $Advertising) { - Set-ItemProperty $Advertising Enabled -Value 0 - } - - #Stops Cortana from being used as part of your Windows Search Function - Write-Host "Stopping Cortana from being used as part of your Windows Search Function" - $Search = 'HKLM:\SOFTWARE\Policies\Microsoft\Windows\Windows Search' - If (Test-Path $Search) { - Set-ItemProperty $Search AllowCortana -Value 0 - } - - #Stops the Windows Feedback Experience from sending anonymous data - Write-Host "Stopping the Windows Feedback Experience program" - $Period1 = 'HKCU:\Software\Microsoft\Siuf' - $Period2 = 'HKCU:\Software\Microsoft\Siuf\Rules' - $Period3 = 'HKCU:\Software\Microsoft\Siuf\Rules\PeriodInNanoSeconds' - If (!(Test-Path $Period3)) { - mkdir $Period1 - mkdir $Period2 - mkdir $Period3 - New-ItemProperty $Period3 PeriodInNanoSeconds -Value 0 - } - - Write-Host "Adding Registry key to prevent bloatware apps from returning" - #Prevents bloatware applications from returning - $registryPath = "HKLM:\SOFTWARE\Policies\Microsoft\Windows\CloudContent" - If (!(Test-Path $registryPath)) { - Mkdir $registryPath - New-ItemProperty $registryPath DisableWindowsConsumerFeatures -Value 1 - } - - Write-Host "Setting Mixed Reality Portal value to 0 so that you can uninstall it in Settings" - $Holo = 'HKCU:\Software\Microsoft\Windows\CurrentVersion\Holographic' - If (Test-Path $Holo) { - Set-ItemProperty $Holo FirstRunSucceeded -Value 0 - } - - #Disables live tiles - Write-Host "Disabling live tiles" - $Live = 'HKCU:\SOFTWARE\Policies\Microsoft\Windows\CurrentVersion\PushNotifications' - If (!(Test-Path $Live)) { - mkdir $Live - New-ItemProperty $Live NoTileApplicationNotification -Value 1 - } - - #Turns off Data Collection via the AllowTelemtry key by changing it to 0 - Write-Host "Turning off Data Collection" - $DataCollection = 'HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\Policies\DataCollection' - If (Test-Path $DataCollection) { - Set-ItemProperty $DataCollection AllowTelemetry -Value 0 - } - - #Disables People icon on Taskbar - Write-Host "Disabling People icon on Taskbar" - $People = 'HKCU:\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\Advanced\People' - If (Test-Path $People) { - Set-ItemProperty $People PeopleBand -Value 0 - } - - #Disables suggestions on start menu - Write-Host "Disabling suggestions on the Start Menu" - $Suggestions = 'HKCU:\Software\Microsoft\Windows\CurrentVersion\ContentDeliveryManager' - If (Test-Path $Suggestions) { - Set-ItemProperty $Suggestions SystemPaneSuggestionsEnabled -Value 0 - } - - - Write-Host "Removing CloudStore from registry if it exists" - $CloudStore = 'HKCUSoftware\Microsoft\Windows\CurrentVersion\CloudStore' - If (Test-Path $CloudStore) { - Stop-Process Explorer.exe -Force - Remove-Item $CloudStore - Start-Process Explorer.exe -Wait - } - - #Loads the registry keys/values below into the NTUSER.DAT file which prevents the apps from redownloading. Credit to a60wattfish - reg load HKU\Default_User C:\Users\Default\NTUSER.DAT - Set-ItemProperty -Path Registry::HKU\Default_User\SOFTWARE\Microsoft\Windows\CurrentVersion\ContentDeliveryManager -Name SystemPaneSuggestionsEnabled -Value 0 - Set-ItemProperty -Path Registry::HKU\Default_User\SOFTWARE\Microsoft\Windows\CurrentVersion\ContentDeliveryManager -Name PreInstalledAppsEnabled -Value 0 - Set-ItemProperty -Path Registry::HKU\Default_User\SOFTWARE\Microsoft\Windows\CurrentVersion\ContentDeliveryManager -Name OemPreInstalledAppsEnabled -Value 0 - reg unload HKU\Default_User - - #Disables scheduled tasks that are considered unnecessary - Write-Host "Disabling scheduled tasks" - #Get-ScheduledTask -TaskName XblGameSaveTaskLogon | Disable-ScheduledTask - Get-ScheduledTask -TaskName XblGameSaveTask | Disable-ScheduledTask - Get-ScheduledTask -TaskName Consolidator | Disable-ScheduledTask - Get-ScheduledTask -TaskName UsbCeip | Disable-ScheduledTask - Get-ScheduledTask -TaskName DmClient | Disable-ScheduledTask - Get-ScheduledTask -TaskName DmClientOnScenarioDownload | Disable-ScheduledTask - } - ProtectPrivacy -}) - - -$listBox.SelectionMode = 'MultiExtended' - -[void] $listBox.Items.Add('Microsoft.BingNews') -[void] $listBox.Items.Add('Microsoft.GetHelp') -[void] $listBox.Items.Add('Microsoft.Getstarted') -[void] $listBox.Items.Add('Microsoft.Messaging') -[void] $listBox.Items.Add('Microsoft.Microsoft3DViewer') -[void] $listBox.Items.Add('Microsoft.MicrosoftOfficeHub') -[void] $listBox.Items.Add('Microsoft.MicrosoftSolitaireCollection') -[void] $listBox.Items.Add('Microsoft.NetworkSpeedTest') -[void] $listBox.Items.Add('Microsoft.News') -[void] $listBox.Items.Add('Microsoft.Office.Lens') -[void] $listBox.Items.Add('Microsoft.Office.OneNote') -[void] $listBox.Items.Add('Microsoft.Office.Sway') -[void] $listBox.Items.Add('Microsoft.OneConnect') -[void] $listBox.Items.Add('Microsoft.People') -[void] $listBox.Items.Add('Microsoft.Print3D') -[void] $listBox.Items.Add('Microsoft.RemoteDesktop') -[void] $listBox.Items.Add('Microsoft.SkypeApp') -[void] $listBox.Items.Add('Microsoft.StorePurchaseApp') -[void] $listBox.Items.Add('Microsoft.Office.Todo.List') -[void] $listBox.Items.Add('Microsoft.Whiteboard') -[void] $listBox.Items.Add('Microsoft.WindowsAlarms') -[void] $listBox.Items.Add('Microsoft.WindowsCamera') -[void] $listBox.Items.Add('microsoft.windowscommunicationsapps') -[void] $listBox.Items.Add('Microsoft.WindowsFeedbackHub') -[void] $listBox.Items.Add('Microsoft.WindowsMaps') -[void] $listBox.Items.Add('Microsoft.WindowsSoundRecorder') -[void] $listBox.Items.Add('Microsoft.Xbox.TCUI') -[void] $listBox.Items.Add('Microsoft.XboxApp') -[void] $listBox.Items.Add('Microsoft.XboxGameOverlay') -[void] $listBox.Items.Add('Microsoft.XboxIdentityProvider') -[void] $listBox.Items.Add('Microsoft.XboxSpeechToTextOverlay') -[void] $listBox.Items.Add('Microsoft.ZuneMusic') -[void] $listBox.Items.Add('Microsoft.ZuneVideo') -[void] $listBox.Items.Add('*EclipseManager*') -[void] $listBox.Items.Add('*ActiproSoftwareLLC*') -[void] $listBox.Items.Add('*AdobeSystemsIncorporated.AdobePhotoshopExpress*') -[void] $listBox.Items.Add('*Duolingo-LearnLanguagesforFree*') -[void] $listBox.Items.Add('*PandoraMediaInc*') -[void] $listBox.Items.Add('*CandyCrush*') -[void] $listBox.Items.Add('*Wunderlist*') -[void] $listBox.Items.Add('*Flipboard*') -[void] $listBox.Items.Add('*Twitter*') -[void] $listBox.Items.Add('*Facebook*') -[void] $listBox.Items.Add('*Spotify*') -[void] $listBox.Items.Add('*Minecraft*') -[void] $listBox.Items.Add('*Royal Revolt*') -[void] $listBox.Items.Add('*Sway*') -[void] $listBox.Items.Add('*Speed Test*') -[void] $listBox.Items.Add('*Dolby*') -[void] $listBox.Items.Add('*Windows.CBSPreview*') -[void] $listBox.Items.Add('*Microsoft.Advertising.Xaml_10.1712.5.0_x64__8wekyb3d8bbwe*') -[void] $listBox.Items.Add('*Microsoft.Advertising.Xaml_10.1712.5.0_x86__8wekyb3d8bbwe*') -[void] $listBox.Items.Add('*Microsoft.BingWeather*') -[void] $listBox.Items.Add('*Microsoft.MSPaint*') -[void] $listBox.Items.Add('*Microsoft.MicrosoftStickyNotes*') -[void] $listBox.Items.Add('*Microsoft.Windows.Photos*') -[void] $listBox.Items.Add('*Microsoft.WindowsCalculator*') -[void] $listBox.Items.Add('*Microsoft.WindowsStore*') - -$form.Controls.Add($listBox) - -$form.Topmost = $true - -$result = $form.ShowDialog() - -if ($result -eq [System.Windows.Forms.DialogResult]::OK) -{ - $x = $listBox.SelectedItems - foreach ($x in $x) { - Get-AppxPackage -Name $x| Remove-AppxPackage - Get-AppxProvisionedPackage -Online | Where-Object DisplayName -like $x | Remove-AppxProvisionedPackage -Online - Write-Verbose "Trying to remove $x." - } -} From 009a3ccd51765632b58627abaaf3b2368223c747 Mon Sep 17 00:00:00 2001 From: Richard Newton Date: Sun, 6 Sep 2020 00:20:48 -0400 Subject: [PATCH 14/15] Removed Windows10Debloater.ps1 No reason for this one to exist. It is just additional work to update it. --- Windows10Debloater.ps1 | 842 ----------------------------------------- 1 file changed, 842 deletions(-) delete mode 100644 Windows10Debloater.ps1 diff --git a/Windows10Debloater.ps1 b/Windows10Debloater.ps1 deleted file mode 100644 index 7bd0d32f..00000000 --- a/Windows10Debloater.ps1 +++ /dev/null @@ -1,842 +0,0 @@ -#This function finds any AppX/AppXProvisioned package and uninstalls it, except for Freshpaint, Windows Calculator, Windows Store, and Windows Photos. -#Also, to note - This does NOT remove essential system services/software/etc such as .NET framework installations, Cortana, Edge, etc. - -#no errors throughout -$ErrorActionPreference = 'silentlycontinue' - -$DebloatFolder = "C:\Temp\Windows10Debloater" -If (Test-Path $DebloatFolder) { - Write-Output "$DebloatFolder exists. Skipping." -} -Else { - Write-Output "The folder "$DebloatFolder" doesn't exist. This folder will be used for storing logs created after the script runs. Creating now." - Start-Sleep 1 - New-Item -Path "$DebloatFolder" -ItemType Directory - Write-Output "The folder $DebloatFolder was successfully created." -} - -Start-Transcript -OutputDirectory "$DebloatFolder" - -Add-Type -AssemblyName PresentationCore, PresentationFramework - -Function DebloatAll { - - [CmdletBinding()] - - Param() - - #Removes AppxPackages - #Credit to /u/GavinEke for a modified version of my whitelist code - [regex]$WhitelistedApps = 'Microsoft.ScreenSketch|Microsoft.Paint3D|Microsoft.WindowsCalculator|Microsoft.WindowsStore|Microsoft.Windows.Photos|CanonicalGroupLimited.UbuntuonWindows|Microsoft.XboxGameCallableUI|Microsoft.XboxGamingOverlay|Microsoft.Xbox.TCUI|Microsoft.XboxGamingOverlay|Microsoft.XboxIdentityProvider|Microsoft.MicrosoftStickyNotes|Microsoft.MSPaint|Microsoft.WindowsCamera|.NET' - Get-AppxPackage -AllUsers | Where-Object {$_.Name -NotMatch $WhitelistedApps} | Remove-AppxPackage - Get-AppxPackage | Where-Object {$_.Name -NotMatch $WhitelistedApps} | Remove-AppxPackage - Get-AppxProvisionedPackage -Online | Where-Object {$_.PackageName -NotMatch $WhitelistedApps} | Remove-AppxProvisionedPackage -Online -} - -Function DebloatBlacklist { - [CmdletBinding()] - - Param () - - $Bloatware = @( - - #Unnecessary Windows 10 AppX Apps - "Microsoft.BingNews" - "Microsoft.DesktopAppInstaller" - "Microsoft.GetHelp" - "Microsoft.Getstarted" - "Microsoft.Messaging" - "Microsoft.Microsoft3DViewer" - "Microsoft.MicrosoftOfficeHub" - "Microsoft.MicrosoftSolitaireCollection" - "Microsoft.NetworkSpeedTest" - "Microsoft.Office.OneNote" - "Microsoft.Office.Sway" - "Microsoft.OneConnect" - "Microsoft.People" - "Microsoft.Print3D" - "Microsoft.RemoteDesktop" - "Microsoft.SkypeApp" - "Microsoft.StorePurchaseApp" - "Microsoft.WindowsAlarms" - #"Microsoft.WindowsCamera" - "microsoft.windowscommunicationsapps" - "Microsoft.WindowsFeedbackHub" - "Microsoft.WindowsMaps" - "Microsoft.WindowsSoundRecorder" - "Microsoft.Xbox.TCUI" - "Microsoft.XboxApp" - "Microsoft.XboxGameOverlay" - "Microsoft.XboxIdentityProvider" - "Microsoft.XboxSpeechToTextOverlay" - "Microsoft.ZuneMusic" - "Microsoft.ZuneVideo" - - #Sponsored Windows 10 AppX Apps - #Add sponsored/featured apps to remove in the "*AppName*" format - "*EclipseManager*" - "*ActiproSoftwareLLC*" - "*AdobeSystemsIncorporated.AdobePhotoshopExpress*" - "*Duolingo-LearnLanguagesforFree*" - "*PandoraMediaInc*" - "*CandyCrush*" - "*Wunderlist*" - "*Flipboard*" - "*Twitter*" - "*Facebook*" - "*Spotify*" - "*Minecraft*" - "*Royal Revolt*" - - #Optional: Typically not removed but you can if you need to for some reason - #"*Microsoft.Advertising.Xaml_10.1712.5.0_x64__8wekyb3d8bbwe*" - #"*Microsoft.Advertising.Xaml_10.1712.5.0_x86__8wekyb3d8bbwe*" - #"*Microsoft.BingWeather*" - #"*Microsoft.MSPaint*" - #"*Microsoft.MicrosoftStickyNotes*" - #"*Microsoft.Windows.Photos*" - #"*Microsoft.WindowsCalculator*" - #"*Microsoft.WindowsStore*" - ) - foreach ($Bloat in $Bloatware) { - Get-AppxPackage -Name $Bloat| Remove-AppxPackage -ErrorAction SilentlyContinue - Get-AppxProvisionedPackage -Online | Where-Object DisplayName -like $Bloat | Remove-AppxProvisionedPackage -Online -ErrorAction SilentlyContinue - Write-Output "Trying to remove $Bloat." - } -} - -Function Remove-Keys { - - [CmdletBinding()] - - Param() - - #These are the registry keys that it will delete. - - $Keys = @( - - #Remove Background Tasks - "HKCR:\Extensions\ContractId\Windows.BackgroundTasks\PackageId\46928bounde.EclipseManager_2.2.4.51_neutral__a5h4egax66k6y" - "HKCR:\Extensions\ContractId\Windows.BackgroundTasks\PackageId\ActiproSoftwareLLC.562882FEEB491_2.6.18.18_neutral__24pqs290vpjk0" - "HKCR:\Extensions\ContractId\Windows.BackgroundTasks\PackageId\Microsoft.MicrosoftOfficeHub_17.7909.7600.0_x64__8wekyb3d8bbwe" - "HKCR:\Extensions\ContractId\Windows.BackgroundTasks\PackageId\Microsoft.PPIProjection_10.0.15063.0_neutral_neutral_cw5n1h2txyewy" - "HKCR:\Extensions\ContractId\Windows.BackgroundTasks\PackageId\Microsoft.XboxGameCallableUI_1000.15063.0.0_neutral_neutral_cw5n1h2txyewy" - "HKCR:\Extensions\ContractId\Windows.BackgroundTasks\PackageId\Microsoft.XboxGameCallableUI_1000.16299.15.0_neutral_neutral_cw5n1h2txyewy" - - #Windows File - "HKCR:\Extensions\ContractId\Windows.File\PackageId\ActiproSoftwareLLC.562882FEEB491_2.6.18.18_neutral__24pqs290vpjk0" - - #Registry keys to delete if they aren't uninstalled by RemoveAppXPackage/RemoveAppXProvisionedPackage - "HKCR:\Extensions\ContractId\Windows.Launch\PackageId\46928bounde.EclipseManager_2.2.4.51_neutral__a5h4egax66k6y" - "HKCR:\Extensions\ContractId\Windows.Launch\PackageId\ActiproSoftwareLLC.562882FEEB491_2.6.18.18_neutral__24pqs290vpjk0" - "HKCR:\Extensions\ContractId\Windows.Launch\PackageId\Microsoft.PPIProjection_10.0.15063.0_neutral_neutral_cw5n1h2txyewy" - "HKCR:\Extensions\ContractId\Windows.Launch\PackageId\Microsoft.XboxGameCallableUI_1000.15063.0.0_neutral_neutral_cw5n1h2txyewy" - "HKCR:\Extensions\ContractId\Windows.Launch\PackageId\Microsoft.XboxGameCallableUI_1000.16299.15.0_neutral_neutral_cw5n1h2txyewy" - - #Scheduled Tasks to delete - "HKCR:\Extensions\ContractId\Windows.PreInstalledConfigTask\PackageId\Microsoft.MicrosoftOfficeHub_17.7909.7600.0_x64__8wekyb3d8bbwe" - - #Windows Protocol Keys - "HKCR:\Extensions\ContractId\Windows.Protocol\PackageId\ActiproSoftwareLLC.562882FEEB491_2.6.18.18_neutral__24pqs290vpjk0" - "HKCR:\Extensions\ContractId\Windows.Protocol\PackageId\Microsoft.PPIProjection_10.0.15063.0_neutral_neutral_cw5n1h2txyewy" - "HKCR:\Extensions\ContractId\Windows.Protocol\PackageId\Microsoft.XboxGameCallableUI_1000.15063.0.0_neutral_neutral_cw5n1h2txyewy" - "HKCR:\Extensions\ContractId\Windows.Protocol\PackageId\Microsoft.XboxGameCallableUI_1000.16299.15.0_neutral_neutral_cw5n1h2txyewy" - - #Windows Share Target - "HKCR:\Extensions\ContractId\Windows.ShareTarget\PackageId\ActiproSoftwareLLC.562882FEEB491_2.6.18.18_neutral__24pqs290vpjk0" - ) - - #This writes the output of each key it is removing and also removes the keys listed above. - ForEach ($Key in $Keys) { - Write-Output "Removing $Key from registry" - Remove-Item $Key -Recurse - } -} - -Function Protect-Privacy { - - [CmdletBinding()] - - Param() - - #Disables Windows Feedback Experience - Write-Output "Disabling Windows Feedback Experience program" - $Advertising = "HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\AdvertisingInfo" - If (Test-Path $Advertising) { - Set-ItemProperty $Advertising Enabled -Value 0 - } - - #Stops Cortana from being used as part of your Windows Search Function - Write-Output "Stopping Cortana from being used as part of your Windows Search Function" - $Search = "HKLM:\SOFTWARE\Policies\Microsoft\Windows\Windows Search" - If (Test-Path $Search) { - Set-ItemProperty $Search AllowCortana -Value 0 - } - - #Disables Web Search in Start Menu - Write-Output "Disabling Bing Search in Start Menu" - $WebSearch = "HKLM:\SOFTWARE\Policies\Microsoft\Windows\Windows Search" - Set-ItemProperty "HKCU:\SOFTWARE\Microsoft\Windows\CurrentVersion\Search" BingSearchEnabled -Value 0 - If (!(Test-Path $WebSearch)) { - New-Item $WebSearch - } - Set-ItemProperty $WebSearch DisableWebSearch -Value 1 - - #Stops the Windows Feedback Experience from sending anonymous data - Write-Output "Stopping the Windows Feedback Experience program" - $Period = "HKCU:\Software\Microsoft\Siuf\Rules" - If (!(Test-Path $Period)) { - New-Item $Period - } - Set-ItemProperty $Period PeriodInNanoSeconds -Value 0 - - #Prevents bloatware applications from returning and removes Start Menu suggestions - Write-Output "Adding Registry key to prevent bloatware apps from returning" - $registryPath = "HKLM:\SOFTWARE\Policies\Microsoft\Windows\CloudContent" - $registryOEM = "HKCU:\SOFTWARE\Microsoft\Windows\CurrentVersion\ContentDeliveryManager" - If (!(Test-Path $registryPath)) { - New-Item $registryPath - } - Set-ItemProperty $registryPath DisableWindowsConsumerFeatures -Value 1 - - If (!(Test-Path $registryOEM)) { - New-Item $registryOEM - } - Set-ItemProperty $registryOEM ContentDeliveryAllowed -Value 0 - Set-ItemProperty $registryOEM OemPreInstalledAppsEnabled -Value 0 - Set-ItemProperty $registryOEM PreInstalledAppsEnabled -Value 0 - Set-ItemProperty $registryOEM PreInstalledAppsEverEnabled -Value 0 - Set-ItemProperty $registryOEM SilentInstalledAppsEnabled -Value 0 - Set-ItemProperty $registryOEM SystemPaneSuggestionsEnabled -Value 0 - - #Preping mixed Reality Portal for removal - Write-Output "Setting Mixed Reality Portal value to 0 so that you can uninstall it in Settings" - $Holo = "HKCU:\Software\Microsoft\Windows\CurrentVersion\Holographic" - If (Test-Path $Holo) { - Set-ItemProperty $Holo FirstRunSucceeded -Value 0 - } - - #Disables Wi-fi Sense - Write-Output "Disabling Wi-Fi Sense" - $WifiSense1 = "HKLM:\SOFTWARE\Microsoft\PolicyManager\default\WiFi\AllowWiFiHotSpotReporting" - $WifiSense2 = "HKLM:\SOFTWARE\Microsoft\PolicyManager\default\WiFi\AllowAutoConnectToWiFiSenseHotspots" - $WifiSense3 = "HKLM:\SOFTWARE\Microsoft\WcmSvc\wifinetworkmanager\config" - If (!(Test-Path $WifiSense1)) { - New-Item $WifiSense1 - } - Set-ItemProperty $WifiSense1 Value -Value 0 - If (!(Test-Path $WifiSense2)) { - New-Item $WifiSense2 - } - Set-ItemProperty $WifiSense2 Value -Value 0 - Set-ItemProperty $WifiSense3 AutoConnectAllowedOEM -Value 0 - - #Disables live tiles - Write-Output "Disabling live tiles" - $Live = "HKCU:\SOFTWARE\Policies\Microsoft\Windows\CurrentVersion\PushNotifications" - If (!(Test-Path $Live)) { - New-Item $Live - } - Set-ItemProperty $Live NoTileApplicationNotification -Value 1 - - #Turns off Data Collection via the AllowTelemtry key by changing it to 0 - Write-Output "Turning off Data Collection" - $DataCollection1 = "HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\Policies\DataCollection" - $DataCollection2 = "HKLM:\SOFTWARE\Policies\Microsoft\Windows\DataCollection" - $DataCollection3 = "HKLM:\SOFTWARE\Wow6432Node\Microsoft\Windows\CurrentVersion\Policies\DataCollection" - If (Test-Path $DataCollection1) { - Set-ItemProperty $DataCollection1 AllowTelemetry -Value 0 - } - If (Test-Path $DataCollection2) { - Set-ItemProperty $DataCollection2 AllowTelemetry -Value 0 - } - If (Test-Path $DataCollection3) { - Set-ItemProperty $DataCollection3 AllowTelemetry -Value 0 - } - - #Disabling Location Tracking - Write-Output "Disabling Location Tracking" - $SensorState = "HKLM:\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Sensor\Overrides\{BFA794E4-F964-4FDB-90F6-51056BFE4B44}" - $LocationConfig = "HKLM:\SYSTEM\CurrentControlSet\Services\lfsvc\Service\Configuration" - If (!(Test-Path $SensorState)) { - New-Item $SensorState - } - Set-ItemProperty $SensorState SensorPermissionState -Value 0 - If (!(Test-Path $LocationConfig)) { - New-Item $LocationConfig - } - Set-ItemProperty $LocationConfig Status -Value 0 - - #Disables People icon on Taskbar - Write-Output "Disabling People icon on Taskbar" - $People = "HKCU:\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\Advanced\People" - If (!(Test-Path $People)) { - New-Item $People - } - Set-ItemProperty $People PeopleBand -Value 0 - - #Disables scheduled tasks that are considered unnecessary - Write-Output "Disabling scheduled tasks" - Get-ScheduledTask XblGameSaveTaskLogon | Disable-ScheduledTask - Get-ScheduledTask XblGameSaveTask | Disable-ScheduledTask - Get-ScheduledTask Consolidator | Disable-ScheduledTask - Get-ScheduledTask UsbCeip | Disable-ScheduledTask - Get-ScheduledTask DmClient | Disable-ScheduledTask - Get-ScheduledTask DmClientOnScenarioDownload | Disable-ScheduledTask - - Write-Output "Stopping and disabling Diagnostics Tracking Service" - #Disabling the Diagnostics Tracking Service - Stop-Service "DiagTrack" - Set-Service "DiagTrack" -StartupType Disabled - - - Write-Output "Removing CloudStore from registry if it exists" - $CloudStore = 'HKCUSoftware\Microsoft\Windows\CurrentVersion\CloudStore' - If (Test-Path $CloudStore) { - Stop-Process Explorer.exe -Force - Remove-Item $CloudStore - Start-Process Explorer.exe -Wait - } -} - -Function DisableCortana { - Write-Host "Disabling Cortana" - $Cortana1 = "HKCU:\SOFTWARE\Microsoft\Personalization\Settings" - $Cortana2 = "HKCU:\SOFTWARE\Microsoft\InputPersonalization" - $Cortana3 = "HKCU:\SOFTWARE\Microsoft\InputPersonalization\TrainedDataStore" - If (!(Test-Path $Cortana1)) { - New-Item $Cortana1 - } - Set-ItemProperty $Cortana1 AcceptedPrivacyPolicy -Value 0 - If (!(Test-Path $Cortana2)) { - New-Item $Cortana2 - } - Set-ItemProperty $Cortana2 RestrictImplicitTextCollection -Value 1 - Set-ItemProperty $Cortana2 RestrictImplicitInkCollection -Value 1 - If (!(Test-Path $Cortana3)) { - New-Item $Cortana3 - } - Set-ItemProperty $Cortana3 HarvestContacts -Value 0 - -} - -Function EnableCortana { - Write-Host "Re-enabling Cortana" - $Cortana1 = "HKCU:\SOFTWARE\Microsoft\Personalization\Settings" - $Cortana2 = "HKCU:\SOFTWARE\Microsoft\InputPersonalization" - $Cortana3 = "HKCU:\SOFTWARE\Microsoft\InputPersonalization\TrainedDataStore" - If (!(Test-Path $Cortana1)) { - New-Item $Cortana1 - } - Set-ItemProperty $Cortana1 AcceptedPrivacyPolicy -Value 1 - If (!(Test-Path $Cortana2)) { - New-Item $Cortana2 - } - Set-ItemProperty $Cortana2 RestrictImplicitTextCollection -Value 0 - Set-ItemProperty $Cortana2 RestrictImplicitInkCollection -Value 0 - If (!(Test-Path $Cortana3)) { - New-Item $Cortana3 - } - Set-ItemProperty $Cortana3 HarvestContacts -Value 1 -} - -Function Stop-EdgePDF { - - #Stops edge from taking over as the default .PDF viewer - Write-Output "Stopping Edge from taking over as the default .PDF viewer" - $NoPDF = "HKCR:\.pdf" - $NoProgids = "HKCR:\.pdf\OpenWithProgids" - $NoWithList = "HKCR:\.pdf\OpenWithList" - If (!(Get-ItemProperty $NoPDF NoOpenWith)) { - New-ItemProperty $NoPDF NoOpenWith - } - If (!(Get-ItemProperty $NoPDF NoStaticDefaultVerb)) { - New-ItemProperty $NoPDF NoStaticDefaultVerb - } - If (!(Get-ItemProperty $NoProgids NoOpenWith)) { - New-ItemProperty $NoProgids NoOpenWith - } - If (!(Get-ItemProperty $NoProgids NoStaticDefaultVerb)) { - New-ItemProperty $NoProgids NoStaticDefaultVerb - } - If (!(Get-ItemProperty $NoWithList NoOpenWith)) { - New-ItemProperty $NoWithList NoOpenWith - } - If (!(Get-ItemProperty $NoWithList NoStaticDefaultVerb)) { - New-ItemProperty $NoWithList NoStaticDefaultVerb - } - - #Appends an underscore '_' to the Registry key for Edge - $Edge = "HKCR:\AppXd4nrz8ff68srnhf9t5a8sbjyar1cr723_" - If (Test-Path $Edge) { - Set-Item $Edge AppXd4nrz8ff68srnhf9t5a8sbjyar1cr723_ - } -} - -Function Revert-Changes { - - [CmdletBinding()] - - Param() - - #This function will revert the changes you made when running the Start-Debloat function. - - #This line reinstalls all of the bloatware that was removed - Get-AppxPackage -AllUsers | ForEach {Add-AppxPackage -Verbose -DisableDevelopmentMode -Register "$($_.InstallLocation)\AppXManifest.xml"} - - #Tells Windows to enable your advertising information. - Write-Output "Re-enabling key to show advertisement information" - $Advertising = "HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\AdvertisingInfo" - If (Test-Path $Advertising) { - Set-ItemProperty $Advertising Enabled -Value 1 - } - - #Enables Cortana to be used as part of your Windows Search Function - Write-Output "Re-enabling Cortana to be used in your Windows Search" - $Search = "HKLM:\SOFTWARE\Policies\Microsoft\Windows\Windows Search" - If (Test-Path $Search) { - Set-ItemProperty $Search AllowCortana -Value 1 - } - - #Re-enables the Windows Feedback Experience for sending anonymous data - Write-Output "Re-enabling Windows Feedback Experience" - $Period = "HKCU:\Software\Microsoft\Siuf\Rules" - If (!(Test-Path $Period)) { - New-Item $Period - } - Set-ItemProperty $Period PeriodInNanoSeconds -Value 1 - - #Enables bloatware applications - Write-Output "Adding Registry key to allow bloatware apps to return" - $registryPath = "HKLM:\SOFTWARE\Policies\Microsoft\Windows\CloudContent" - If (!(Test-Path $registryPath)) { - New-Item $registryPath - } - Set-ItemProperty $registryPath DisableWindowsConsumerFeatures -Value 0 - - #Changes Mixed Reality Portal Key 'FirstRunSucceeded' to 1 - Write-Output "Setting Mixed Reality Portal value to 1" - $Holo = "HKCU:\Software\Microsoft\Windows\CurrentVersion\Holographic" - If (Test-Path $Holo) { - Set-ItemProperty $Holo FirstRunSucceeded -Value 1 - } - - #Re-enables live tiles - Write-Output "Enabling live tiles" - $Live = "HKCU:\SOFTWARE\Policies\Microsoft\Windows\CurrentVersion\PushNotifications" - If (!(Test-Path $Live)) { - New-Item $Live - } - Set-ItemProperty $Live NoTileApplicationNotification -Value 0 - - #Re-enables data collection - Write-Output "Re-enabling data collection" - $DataCollection = "HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\Policies\DataCollection" - If (!(Test-Path $DataCollection)) { - New-Item $DataCollection - } - Set-ItemProperty $DataCollection AllowTelemetry -Value 1 - - #Re-enables People Icon on Taskbar - Write-Output "Enabling People icon on Taskbar" - $People = "HKCU:\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\Advanced\People" - If (!(Test-Path $People)) { - New-Item $People - } - Set-ItemProperty $People PeopleBand -Value 1 - - #Re-enables suggestions on start menu - Write-Output "Enabling suggestions on the Start Menu" - $Suggestions = "HKCU:\Software\Microsoft\Windows\CurrentVersion\ContentDeliveryManager" - If (!(Test-Path $Suggestions)) { - New-Item $Suggestions - } - Set-ItemProperty $Suggestions SystemPaneSuggestionsEnabled -Value 1 - - #Re-enables scheduled tasks that were disabled when running the Debloat switch - Write-Output "Enabling scheduled tasks that were disabled" - Get-ScheduledTask XblGameSaveTaskLogon | Enable-ScheduledTask - Get-ScheduledTask XblGameSaveTask | Enable-ScheduledTask - Get-ScheduledTask Consolidator | Enable-ScheduledTask - Get-ScheduledTask UsbCeip | Enable-ScheduledTask - Get-ScheduledTask DmClient | Enable-ScheduledTask - Get-ScheduledTask DmClientOnScenarioDownload | Enable-ScheduledTask - - Write-Output "Re-enabling and starting WAP Push Service" - #Enable and start WAP Push Service - Set-Service "dmwappushservice" -StartupType Automatic - Start-Service "dmwappushservice" - - Write-Output "Re-enabling and starting the Diagnostics Tracking Service" - #Enabling the Diagnostics Tracking Service - Set-Service "DiagTrack" -StartupType Automatic - Start-Service "DiagTrack" -} - -Function CheckDMWService { - - Param([switch]$Debloat) - -If (Get-Service -Name dmwappushservice | Where-Object {$_.StartType -eq "Disabled"}) { - Set-Service -Name dmwappushservice -StartupType Automatic} - -If(Get-Service -Name dmwappushservice | Where-Object {$_.Status -eq "Stopped"}) { - Start-Service -Name dmwappushservice} - } - -Function Enable-EdgePDF { - Write-Output "Setting Edge back to default" - $NoPDF = "HKCR:\.pdf" - $NoProgids = "HKCR:\.pdf\OpenWithProgids" - $NoWithList = "HKCR:\.pdf\OpenWithList" - #Sets edge back to default - If (Get-ItemProperty $NoPDF NoOpenWith) { - Remove-ItemProperty $NoPDF NoOpenWith - } - If (Get-ItemProperty $NoPDF NoStaticDefaultVerb) { - Remove-ItemProperty $NoPDF NoStaticDefaultVerb - } - If (Get-ItemProperty $NoProgids NoOpenWith) { - Remove-ItemProperty $NoProgids NoOpenWith - } - If (Get-ItemProperty $NoProgids NoStaticDefaultVerb) { - Remove-ItemProperty $NoProgids NoStaticDefaultVerb - } - If (Get-ItemProperty $NoWithList NoOpenWith) { - Remove-ItemProperty $NoWithList NoOpenWith - } - If (Get-ItemProperty $NoWithList NoStaticDefaultVerb) { - Remove-ItemProperty $NoWithList NoStaticDefaultVerb - } - - #Removes an underscore '_' from the Registry key for Edge - $Edge2 = "HKCR:\AppXd4nrz8ff68srnhf9t5a8sbjyar1cr723_" - If (Test-Path $Edge2) { - Set-Item $Edge2 AppXd4nrz8ff68srnhf9t5a8sbjyar1cr723 - } -} - -Function FixWhitelistedApps { - - [CmdletBinding()] - - Param() - - If (!(Get-AppxPackage -AllUsers | Select Microsoft.Paint3D, Microsoft.WindowsCalculator, Microsoft.WindowsStore, Microsoft.Windows.Photos)) { - - #Credit to abulgatz for these 4 lines of code - Get-AppxPackage -allusers Microsoft.Paint3D | Foreach {Add-AppxPackage -DisableDevelopmentMode -Register "$($_.InstallLocation)\AppXManifest.xml"} - Get-AppxPackage -allusers Microsoft.WindowsCalculator | Foreach {Add-AppxPackage -DisableDevelopmentMode -Register "$($_.InstallLocation)\AppXManifest.xml"} - Get-AppxPackage -allusers Microsoft.WindowsStore | Foreach {Add-AppxPackage -DisableDevelopmentMode -Register "$($_.InstallLocation)\AppXManifest.xml"} - Get-AppxPackage -allusers Microsoft.Windows.Photos | Foreach {Add-AppxPackage -DisableDevelopmentMode -Register "$($_.InstallLocation)\AppXManifest.xml"} - } -} - -Function UninstallOneDrive { - - Write-Output "Checking for pre-existing files and folders located in the OneDrive folders..." - Start-Sleep 1 - If (Get-Item -Path "$env:USERPROFILE\OneDrive\*") { - Write-Output "Files found within the OneDrive folder! Checking to see if a folder named OneDriveBackupFiles exists." - Start-Sleep 1 - - If (Get-Item "$env:USERPROFILE\Desktop\OneDriveBackupFiles" -ErrorAction SilentlyContinue) { - Write-Output "A folder named OneDriveBackupFiles already exists on your desktop. All files from your OneDrive location will be moved to that folder." - } - else { - If (!(Get-Item "$env:USERPROFILE\Desktop\OneDriveBackupFiles" -ErrorAction SilentlyContinue)) { - Write-Output "A folder named OneDriveBackupFiles will be created and will be located on your desktop. All files from your OneDrive location will be located in that folder." - New-item -Path "$env:USERPROFILE\Desktop" -Name "OneDriveBackupFiles"-ItemType Directory -Force - Write-Output "Successfully created the folder 'OneDriveBackupFiles' on your desktop." - } - } - Start-Sleep 1 - Move-Item -Path "$env:USERPROFILE\OneDrive\*" -Destination "$env:USERPROFILE\Desktop\OneDriveBackupFiles" -Force - Write-Output "Successfully moved all files/folders from your OneDrive folder to the folder 'OneDriveBackupFiles' on your desktop." - Start-Sleep 1 - Write-Output "Proceeding with the removal of OneDrive." - Start-Sleep 1 - } - Else { - If (!(Get-Item -Path "$env:USERPROFILE\OneDrive\*")) { - Write-Output "Either the OneDrive folder does not exist or there are no files to be found in the folder. Proceeding with removal of OneDrive." - Start-Sleep 1 - } - } - - Write-Output "Uninstalling OneDrive" - - New-PSDrive HKCR -PSProvider Registry -Root HKEY_CLASSES_ROOT - $onedrive = "$env:SYSTEMROOT\SysWOW64\OneDriveSetup.exe" - $ExplorerReg1 = "HKCR:\CLSID\{018D5C66-4533-4307-9B53-224DE2ED1FE6}" - $ExplorerReg2 = "HKCR:\Wow6432Node\CLSID\{018D5C66-4533-4307-9B53-224DE2ED1FE6}" - Stop-Process -Name "OneDrive*" - Start-Sleep 2 - If (!(Test-Path $onedrive)) { - $onedrive = "$env:SYSTEMROOT\System32\OneDriveSetup.exe" - } - Start-Process $onedrive "/uninstall" -NoNewWindow -Wait - Start-Sleep 2 - Write-Output "Stopping explorer" - Start-Sleep 1 - .\taskkill.exe /F /IM explorer.exe - Start-Sleep 3 - Write-Output "Removing leftover files" - Remove-Item "$env:USERPROFILE\OneDrive" -Force -Recurse - Remove-Item "$env:LOCALAPPDATA\Microsoft\OneDrive" -Force -Recurse - Remove-Item "$env:PROGRAMDATA\Microsoft OneDrive" -Force -Recurse - If (Test-Path "$env:SYSTEMDRIVE\OneDriveTemp") { - Remove-Item "$env:SYSTEMDRIVE\OneDriveTemp" -Force -Recurse - } - Write-Output "Removing OneDrive from windows explorer" - If (!(Test-Path $ExplorerReg1)) { - New-Item $ExplorerReg1 - } - Set-ItemProperty $ExplorerReg1 System.IsPinnedToNameSpaceTree -Value 0 - If (!(Test-Path $ExplorerReg2)) { - New-Item $ExplorerReg2 - } - Set-ItemProperty $ExplorerReg2 System.IsPinnedToNameSpaceTree -Value 0 - Write-Output "Restarting Explorer that was shut down before." - Start-Process explorer.exe -NoNewWindow - - Write-Host "Enabling the Group Policy 'Prevent the usage of OneDrive for File Storage'." - $OneDriveKey = 'HKLM:Software\Policies\Microsoft\Windows\OneDrive' - If (!(Test-Path $OneDriveKey)) { - Mkdir $OneDriveKey - } - - $DisableAllOneDrive = 'HKLM:Software\Policies\Microsoft\Windows\OneDrive' - If (Test-Path $DisableAllOneDrive) { - New-ItemProperty $DisableAllOneDrive -Name OneDrive -Value DisableFileSyncNGSC -Verbose - } -} - -#GUI prompt Debloat/Revert options and GUI variables -$Button = [Windows.MessageBoxButton]::YesNoCancel -$ErrorIco = [Windows.MessageBoxImage]::Error -$Warn = [Windows.MessageBoxImage]::Warning -$Ask = 'The following will allow you to either Debloat Windows 10 or to revert changes made after Debloating Windows 10. - - Select "Yes" to Debloat Windows 10 - - Select "No" to Revert changes made by this script - - Select "Cancel" to stop the script.' - -$EverythingorSpecific = "Would you like to remove everything that was preinstalled on your Windows Machine? Select Yes to remove everything, or select No to remove apps via a blacklist." -$EdgePdf = "Do you want to stop edge from taking over as the default PDF viewer?" -$EdgePdf2 = "Do you want to revert changes that disabled Edge as the default PDF viewer?" -$Reboot = "For some of the changes to properly take effect it is recommended to reboot your machine. Would you like to restart?" -$OneDriveDelete = "Do you want to uninstall One Drive?" - -$Prompt1 = [Windows.MessageBox]::Show($Ask, "Debloat or Revert", $Button, $ErrorIco) -Switch ($Prompt1) { - #This will debloat Windows 10 - Yes { - - $Prompt2 = [Windows.MessageBox]::Show($EverythingorSpecific, "Everything or Specific", $Button, $Warn) - switch ($Prompt2) { - Yes { - #Creates a "drive" to access the HKCR (HKEY_CLASSES_ROOT) - Write-Output "Creating PSDrive 'HKCR' (HKEY_CLASSES_ROOT). This will be used for the duration of the script as it is necessary for the removal and modification of specific registry keys." - New-PSDrive HKCR -PSProvider Registry -Root HKEY_CLASSES_ROOT - Start-Sleep 1 - Write-Output "Uninstalling bloatware, please wait." - DebloatAll - Write-Output "Bloatware removed." - Start-Sleep 1 - Write-Output "Removing specific registry keys." - Remove-Keys - Write-Output "Leftover bloatware registry keys removed." - Start-Sleep 1 - Write-Output "Checking to see if any Whitelisted Apps were removed, and if so re-adding them." - Start-Sleep 1 - FixWhitelistedApps - Start-Sleep 1 - Write-Output "Disabling Cortana from search, disabling feedback to Microsoft, and disabling scheduled tasks that are considered to be telemetry or unnecessary." - Protect-Privacy - Start-Sleep 1 - DisableCortana - Write-Output "Cortana disabled and removed from search, feedback to Microsoft has been disabled, and scheduled tasks are disabled." - Start-Sleep 1 - Write-Output "Stopping and disabling Diagnostics Tracking Service" - DisableDiagTrack - Write-Output "Diagnostics Tracking Service disabled" - Start-Sleep 1 - Write-Output "Disabling WAP push service" - Start-Sleep 1 - DisableWAPPush - Write-Output "Re-enabling DMWAppushservice if it was disabled" - CheckDMWService - Start-Sleep 1 - } - No { - #Creates a "drive" to access the HKCR (HKEY_CLASSES_ROOT) - Write-Output "Creating PSDrive 'HKCR' (HKEY_CLASSES_ROOT). This will be used for the duration of the script as it is necessary for the removal and modification of specific registry keys." - New-PSDrive HKCR -PSProvider Registry -Root HKEY_CLASSES_ROOT - Start-Sleep 1 - Write-Output "Uninstalling bloatware, please wait." - DebloatBlacklist - Write-Output "Bloatware removed." - Start-Sleep 1 - Write-Output "Removing specific registry keys." - Remove-Keys - Write-Output "Leftover bloatware registry keys removed." - Start-Sleep 1 - Write-Output "Checking to see if any Whitelisted Apps were removed, and if so re-adding them." - Start-Sleep 1 - FixWhitelistedApps - Start-Sleep 1 - Write-Output "Disabling Cortana from search, disabling feedback to Microsoft, and disabling scheduled tasks that are considered to be telemetry or unnecessary." - Protect-Privacy - Start-Sleep 1 - DisableCortana - Write-Output "Cortana disabled and removed from search, feedback to Microsoft has been disabled, and scheduled tasks are disabled." - Start-Sleep 1 - Write-Output "Stopping and disabling Diagnostics Tracking Service" - DisableDiagTrack - Write-Output "Diagnostics Tracking Service disabled" - Start-Sleep 1 - Write-Output "Disabling WAP push service" - Start-Sleep 1 - DisableWAPPush - Write-Output "Re-enabling DMWAppushservice if it was disabled" - CheckDMWService - Start-Sleep 1 - } - } - - $Prompt3 = [Windows.MessageBox]::Show($EdgePdf, "Edge PDF", $Button, $Warn) - Switch ($Prompt3) { - Yes { - Stop-EdgePDF - Write-Output "Edge will no longer take over as the default PDF viewer." - } - No { - Write-Output "You chose not to stop Edge from taking over as the default PDF viewer." - } - } - #Prompt asking to delete OneDrive - $Prompt4 = [Windows.MessageBox]::Show($OneDriveDelete, "Delete OneDrive", $Button, $ErrorIco) - Switch ($Prompt4) { - Yes { - UninstallOneDrive - Write-Output "OneDrive is now removed from the computer." - } - No { - Write-Output "You have chosen to skip removing OneDrive from your machine." - } - } - #Prompt asking if you'd like to reboot your machine - $Prompt5 = [Windows.MessageBox]::Show($Reboot, "Reboot", $Button, $Warn) - Switch ($Prompt5) { - Yes { - Write-Output "Unloading the HKCR drive..." - Remove-PSDrive HKCR - Start-Sleep 1 - Stop-Transcript - Write-Output "Initiating reboot." - Start-Sleep 2 - Restart-Computer - } - No { - Write-Output "Unloading the HKCR drive..." - Remove-PSDrive HKCR - Start-Sleep 1 - Stop-Transcript - Write-Output "Script has finished. Exiting." - Start-Sleep 2 - Exit - } - } - } - No { - Write-Output "Reverting changes..." - Write-Output "Creating PSDrive 'HKCR' (HKEY_CLASSES_ROOT). This will be used for the duration of the script as it is necessary for the modification of specific registry keys." - New-PSDrive HKCR -PSProvider Registry -Root HKEY_CLASSES_ROOT - Revert-Changes - #Prompt asking to revert edge changes as well - $Prompt6 = [Windows.MessageBox]::Show($EdgePdf2, "Revert Edge", $Button, $ErrorIco) - Switch ($Prompt6) { - Yes { - Enable-EdgePDF - Write-Output "Edge will no longer be disabled from being used as the default Edge PDF viewer." - } - No { - Write-Output "You have chosen to keep the setting that disallows Edge to be the default PDF viewer." - } - } - #Prompt asking if you'd like to reboot your machine - $Prompt7 = [Windows.MessageBox]::Show($Reboot, "Reboot", $Button, $Warn) - Switch ($Prompt7) { - Yes { - Write-Output "Unloading the HKCR drive..." - Remove-PSDrive HKCR - Start-Sleep 1 - Write-Output "Initiating reboot." - Stop-Transcript - Start-Sleep 2 - Restart-Computer - } - No { - Write-Output "Unloading the HKCR drive..." - Remove-PSDrive HKCR - Start-Sleep 1 - Write-Output "Script has finished. Exiting." - Stop-Transcript - Start-Sleep 2 - Exit - } - } - } -} - - -#Function that is in testing. Can't figure out why I cannot delete the C:\Program Files\WindowsApps path - -Function DeleteBloatwareSystemFolders { - Write-Output "This will delete the folders located at: - - C:\Windows\SystemApps and C:\Program Files\WindowsApps. This will prevent the bloatware from coming back by removing the included .xml files as well as` - any other files within the folders associated with the bloatware apps." - - $Windowsapps = @( - "*Microsoft.BingWeather*" - "*Microsoft.GetHelp*" - "*Microsoft.Getstarted*" - "*Microsoft.Microsoft3DViewer*" - "*Microsoft.MicrosoftOfficeHub*" - "*Microsoft.MicrosoftSolitaireCollection*" - "*Microsoft.MixedReality.Portal*" - #"*Microsoft.Office.OneNote*" - "*Microsoft.OneConnect*" - "*Microsoft.People*" - "*Microsoft.Print3D*" - "*Microsoft.ScreenSketch*" - "*Microsoft.SkypeApp*" - "*Microsoft.WindowsAlarms*" - "*microsoft.windowscommunicationsapps*" - "*Microsoft.WindowsFeedbackHub*" - "*Microsoft.WindowsMaps*" - "*Microsoft.WindowsSoundRecorder*" - #"*Microsoft.WindowsStore*" - "*Microsoft.Xbox*" - "*Microsoft.YourPhone*" - "*Microsoft.ZuneMusic*" - ) - Start-process Powershell Get-Credential "" - - foreach ($app in $Windowsapps) { - Remove-Item -Recurse "C:\Program Files\WindowsApps\$app" -force - Write-Output "Trying to remove $app." - } - - #This works to take ownership of the path. But I think PS is running as system and not myself. - #takeown.exe /f 'C:\Program Files\WindowsApps' - -} - -Start-Process powershell.exe -Credential "domain\username" -NoNewWindow -ArgumentList "Start-Process powershell.exe -Verb runAs" - - From 6ddc1b402697eac086a0a22bfd44fc6bb0c319b2 Mon Sep 17 00:00:00 2001 From: Richard Newton Date: Sun, 6 Sep 2020 00:25:14 -0400 Subject: [PATCH 15/15] Changed text of restore point cmdlet --- W10DebloaterGUI.ps1 | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/W10DebloaterGUI.ps1 b/W10DebloaterGUI.ps1 index 497eb0a6..fa66c3ee 100644 --- a/W10DebloaterGUI.ps1 +++ b/W10DebloaterGUI.ps1 @@ -217,7 +217,7 @@ Switch ($Prompt1) { $TextBox1.AppendText("Creating System Restore point. Please wait... ") -Checkpoint-Computer -Description "Install MyApp" -Verbose +Checkpoint-Computer -Description "Before using W10DebloaterGUI.ps1" -Verbose @@ -260,8 +260,8 @@ Checkpoint-Computer -Description "Install MyApp" -Verbose Break } - } - } ) + } +} ) $Button2.Add_Click( {