|
@@ -130,13 +130,6 @@ $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'
|
|
|
-
|
|
|
$InstallNet35 = New-Object system.Windows.Forms.Button
|
|
|
$InstallNet35.text = "Install .NET v3.5"
|
|
|
$InstallNet35.width = 152
|
|
@@ -541,277 +534,6 @@ $RemoveAllBloatware.Add_Click( {
|
|
|
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 "Starting Sysprep Fixes"
|
|
|
-
|
|
|
- # Disable Windows Store Automatic Updates
|
|
|
- Write-Host "Adding Registry key to Disable Windows Store Automatic Updates"
|
|
|
- $registryPath = "HKLM:\SOFTWARE\Policies\Microsoft\WindowsStore"
|
|
|
- If (!(Test-Path $registryPath)) {
|
|
|
- Mkdir $registryPath
|
|
|
- New-ItemProperty $registryPath AutoDownload -Value 2
|
|
|
- }
|
|
|
- Set-ItemProperty $registryPath AutoDownload -Value 2
|
|
|
-
|
|
|
- #Stop WindowsStore Installer Service and set to Disabled
|
|
|
- Write-Host "Stopping InstallService"
|
|
|
- Stop-Service InstallService
|
|
|
- Write-Host "Setting InstallService Startup to Disabled"
|
|
|
- & Set-Service 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.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'
|
|
|
- Get-AppxPackage -AllUsers | Where-Object {$_.Name -NotMatch $WhitelistedApps} | Remove-AppxPackage
|
|
|
- # Run this again to avoid error on 1803 or having to reboot.
|
|
|
- Get-AppxPackage -AllUsers | Where-Object {$_.Name -NotMatch $WhitelistedApps} | Remove-AppxPackage
|
|
|
- Get-AppxProvisionedPackage -Online | Where-Object {$_.PackageName -NotMatch $WhitelistedApps} | Remove-AppxProvisionedPackage -Online
|
|
|
- }
|
|
|
-
|
|
|
- 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
|
|
|
- }
|
|
|
- }
|
|
|
-
|
|
|
- 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 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 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
|
|
|
- mkdir $Period2
|
|
|
- mkdir $Period3
|
|
|
- New-ItemProperty $Period3 PeriodInNanoSeconds -Value 0 -Verbose
|
|
|
- }
|
|
|
-
|
|
|
- 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 -Verbose
|
|
|
- }
|
|
|
-
|
|
|
- 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 -Verbose
|
|
|
- }
|
|
|
-
|
|
|
- #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 -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 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) {
|
|
|
- Set-ItemProperty $People 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 SystemPaneSuggestionsEnabled -Value 0 -Verbose
|
|
|
- }
|
|
|
-
|
|
|
- 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
|
|
|
- }
|
|
|
-
|
|
|
- Function UnpinStart {
|
|
|
- #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()}
|
|
|
- }
|
|
|
-
|
|
|
- #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 CheckDMWService {
|
|
|
-
|
|
|
- Param([switch]$Debloat)
|
|
|
-
|
|
|
- If (Get-Service dmwappushservice | Where-Object {$_.StartType -eq "Disabled"}) {
|
|
|
- Set-Service dmwappushservice -StartupType Automatic
|
|
|
- }
|
|
|
-
|
|
|
- If (Get-Service dmwappushservice | Where-Object {$_.Status -eq "Stopped"}) {
|
|
|
- Start-Service dmwappushservice
|
|
|
- }
|
|
|
- }
|
|
|
-
|
|
|
- Function CheckInstallService {
|
|
|
-
|
|
|
- If (Get-Service InstallService | Where-Object {$_.Status -eq "Stopped"}) {
|
|
|
- Start-Service InstallService
|
|
|
- Set-Service InstallService -StartupType Automatic
|
|
|
- }
|
|
|
- }
|
|
|
-
|
|
|
- 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 "Unpinning tiles from the Start Menu."
|
|
|
- UnpinStart
|
|
|
- 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."
|
|
|
- CheckDMWService
|
|
|
- Write-Host "Setting the 'InstallService' Windows service back to started and setting the Startup Type to 'Automatic'."
|
|
|
- CheckInstallService
|
|
|
- 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.
|