LIMEHAWK - Managed IT
Server Disk Cleanup — automation
dateNov 29, 2024
statusRESOLVED
space recovered47.3 GB
Incident

Application server at 99.2% disk capacity. Security patches failing to install. Event log flooded with "insufficient disk space" errors. Users getting random application crashes. 256GB C: drive had 1.8GB free, Windows needed 4GB minimum for pending cumulative update. Standard Disk Cleanup recovered 400MB. Not enough.

Assessment
C: drive252GB used of 256GB (0.7% free)
Windows Updatefailing, needs 4GB free
event log847 "disk full" errors in 24h
application dataonly 67GB - not the problem

5-year-old server upgraded in-place from Server 2016 → 2019 → 2022, carrying forward years of accumulated cruft. TreeSize revealed: WinSxS 48GB, SoftwareDistribution 23GB, Windows.old 19GB from 2019→2022 upgrade never cleaned.

Why Standard Cleanup Failed
Windows.old — button grayed out - file locks
SoftwareDistrib — only clears Download (2GB), not DataStore (21GB)
WinSxS — "marks" for removal, doesn't actually delete
Search index — 4.2GB Windows.edb - Disk Cleanup won't touch
Solution

Aggressive cleanup script via RMM. Goes beyond what Disk Cleanup touches - stops services to release file locks, runs DISM directly for WinSxS cleanup, rebuilds search index from scratch.

What Gets Cleaned
1. cleanmgr /verylowdiskemergency mode
2. SoftwareDistributionstop WU, delete ENTIRE folder
3. DISM /StartComponentCleanupremove superseded WinSxS
4. Windows.edbdelete search index, force rebuild

Key insight: Real space savings come from WinSxS component cleanup. On this server, DISM recovered 31GB of superseded system file versions from 5 years of upgrades.

Outcome
space recovered47.3 GB from Windows bloat
free space after49.1 GB (19.2% of C:)
script runtime23 minutes (mostly DISM)

Rebooted server, pending Windows Update installed successfully, application crashes stopped.

standard Disk Cleanup too conservative, leaves real bloat
WinSxS grows forever on upgrade-in-place machines
SoftwareDistribution needs services stopped to fully clean
we now run this monthly on all servers - proactive
Get Help

Tired of disk space alerts? We implement proactive storage management that prevents emergencies.