Setup Prod Offscrub -

If you manage a Windows environment—especially one involving Remote Desktop Services (RDS), Citrix, or VMware Horizon—you’ve likely heard of OffScrub . It’s a powerful script from Microsoft’s SysInternals suite (specifically part of PSExec and the Windows Assessment Toolkit) used to selectively disable or stop non-essential background processes, services, and scheduled tasks.

foreach ($svc in $servicesToStop) if (Get-Service -Name $svc -ErrorAction SilentlyContinue) Stop-Service $svc -Force Set-Service $svc -StartupType Disabled Write-Host "Disabled: $svc"

Write-Host "OffScrub completed - $(Get-Date)" In production, you need rollback capability and exclusion logic . A. Create an undo script Before disabling anything, export current state: setup prod offscrub

$backup = Import-Clixml -Path "C:\OffScrubBackup\services_before.xml" foreach ($svc in $backup) Set-Service $svc.Name -StartupType $svc.StartType

if ((Get-WindowsFeature -Name AD-Domain-Services).Installed) Write-Error "This is a Domain Controller. OffScrub aborted." exit 1 "Microsoft\Windows\Power Efficiency Diagnostics*" )

Get-Service | Where-Object $_.StartType -eq "Disabled" | Export-Clixml -Path "C:\OffScrubBackup\services_before.xml" Restore script:

| Service Name | Required? | OffScrub Action | |--------------|-----------|------------------| | Spooler | Yes (printing) | Keep | | WSearch | No (search indexing) | Disable | | SysMain | No (Superfetch) | Disable | | Themes | Yes (UI stability) | Keep | The most common production-ready implementation is a PowerShell script that wraps Set-Service , Stop-Process , and Disable-ScheduledTask . setup prod offscrub

$tasksToDisable = @( "Microsoft\Windows\DiskDiagnostic*", "Microsoft\Windows\Power Efficiency Diagnostics*" )