Offscrub - Setup Prod
if ((Get-WindowsFeature -Name AD-Domain-Services).Installed) Write-Error "This is a Domain Controller. OffScrub aborted." exit 1
When done correctly, OffScrub can significantly reduce memory and CPU overhead on VDI/RDSH hosts, sometimes improving user density by 15–25%. When done wrong, it can take down a production farm in minutes. 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)
You can start with the (part of the Windows ADK) or build your own. Basic production-safe template: # ProductionOffScrub.ps1 # Run as SYSTEM or Administrator $servicesToStop = @( "WSearch", # Windows Search "SysMain", # Superfetch "DiagTrack", # Diagnostics Tracking "dmwappushservice" ) and Disable-ScheduledTask .
Get-Service | Where-Object $_.StartType -eq "Disabled" | Export-Clixml -Path "C:\OffScrubBackup\services_before.xml" Restore script:
Do not run OffScrub on domain controllers or SQL servers without overrides.
| 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 .