Last active
March 25, 2024 17:16
-
-
Save TheDayIsMyEnemy/7cb746be31d48691908cd8e5416000c9 to your computer and use it in GitHub Desktop.
Set-ExecutionPolicy unrestricted
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$servicesToDisable = @( | |
"AdobeARMservice", | |
"AdobeFlashPlayerUpdateSvc", | |
"wuauserv", # Windows Update | |
"BITS", # Background Intelligent Transfer Service | |
"DoSvc", # Delivery Optimization | |
"DiagTrack", # Connected User Experiences and Telemetry | |
"dmwappushservice", # DMWAPPushSvc | |
"MapsBroker", # Downloaded Maps Manager | |
"WMPNetworkSvc", # Windows Media Player Network Sharing Service | |
"wscsvc", # Security Center | |
"SysMain", # Superfetch | |
"PrintNotify", # Printer Extensions and Notifications | |
"Spooler", # Print Spooler | |
"TrkWks", # Distributed Link Tracking Client | |
"WbioSrvc", # Windows Biometric Service | |
"XblAuthManager", # Xbox Live Auth Manager | |
"XblGameSave", # Xbox Live Game Save | |
"XboxGipSvc" # Xbox Live Networking Service | |
) | |
foreach ($service in $servicesToDisable) { | |
Stop-Service -Name $service -Force | |
Set-Service -Name $service -StartupType Disabled | |
Write-Host "Service $service stopped and disabled." | |
} | |
$featuresToUninstall = @( | |
"Internet-Explorer-Optional-amd64", | |
"WindowsMediaPlayer", | |
"MediaPlayback", | |
"Microsoft-Windows-RemoteDesktopServices-Tools", | |
"Windows-Defender-Features", | |
"Printing-Foundation-InternetPrinting-Client", | |
"Printing-Foundation-LPDPrintService", | |
"SMB1Protocol", | |
"TelnetClient", | |
"XPS-Viewer" | |
) | |
foreach ($feature in $featuresToUninstall) { | |
Write-Host "Uninstalling feature/component: $feature" | |
Disable-WindowsOptionalFeature -Online -FeatureName $feature -NoRestart | |
} | |
$appsToRemove = @( | |
"Microsoft.XboxApp", | |
"Microsoft.Microsoft3DViewer", | |
"Microsoft.MicrosoftOfficeHub", | |
"Microsoft.WindowsMaps", | |
"Microsoft.YourPhone", | |
"Microsoft.SkypeApp", | |
"Microsoft.OneConnect", | |
"Microsoft.Print3D", | |
"Microsoft.StorePurchaseApp" | |
) | |
foreach ($app in $appsToRemove) { | |
Write-Host "Removing app: $app" | |
Get-AppxPackage -AllUsers | Where-Object {$_.Name -eq $app} | Remove-AppxPackage | |
} | |
Write-Host "Cleaning up temporary files..." | |
Remove-Item -Path "$env:SystemRoot\SoftwareDistribution\Download\*" -Force -Recurse | |
Remove-Item -Path "$env:SystemRoot\Temp\*" -Force -Recurse | |
Write-Host "Script execution complete." |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment