Volumes on rented Windows machines rarely fail because the provider is stingy. They fill because Server roles keep their own caches, because the servicing stack leaves old payload behind, and because nobody mapped which folder owns the free space. Treat cleanup as inventory first and deletion second: measure, attribute, remove only what has a documented way back, then leave a scheduled job behind.
If you are still choosing a plan, the disk you are given matters more than the cleanup method — see our Windows VPS plans for the volume attached to each tier. A 40 GB system drive with monthly patching hits its ceiling within a year; 100 GB gives the same workload comfortable margin.
Measure first: where the space actually went
Start with a directory ranking, not a guess about Windows Update. The one-liner below returns the ten largest top-level folders on C:. It is slow on cold metadata, which is acceptable — you run it once per investigation.
Get-ChildItem C:\ -Directory -Force -ErrorAction SilentlyContinue | ForEach-Object {
$s = (Get-ChildItem $_.FullName -Recurse -File -Force -ErrorAction SilentlyContinue |
Measure-Object Length -Sum).Sum
[pscustomobject]@{ Path = $_.FullName; GB = [math]::Round($s/1GB,2) }
} | Sort-Object GB -Descending | Select-Object -First 10
On a web or RDP host the leaders are usually WinSxS, Windows\Installer, inetpub\logs, and user profiles. Record the baseline: repeating the output a week later tells you whether your maintenance job holds the line or whether something regenerates faster than you delete. Do not treat WinSxS as a normal folder — its size counts hard links shared with the live component store, and deleting by hand breaks servicing.
Component store cleanup with DISM, done correctly
Superseded component versions pile up after every cumulative update. StartComponentCleanup removes those no longer required by the current image. Add /ResetBase only when you accept that installed updates can no longer be uninstalled — fine on a stable production host, a poor choice on one still being patched blindly.
DISM /Online /Cleanup-Image /AnalyzeComponentStore
DISM /Online /Cleanup-Image /StartComponentCleanup
REM optional, irreversible:
DISM /Online /Cleanup-Image /StartComponentCleanup /ResetBase
The analyze pass ends with a reclaimable-package count and a “Cleanup Recommended” flag. Expect one to four gigabytes back on a host that has taken a year of rollups. It can run twenty minutes at high disk queue, so schedule it in a maintenance window and never concurrently with an update install.
Automating the safe half with cleanmgr and sageset
Cleanmgr is old but still the least risky handler for temporary data. Scripting it needs the sageset/sagerun registry handshake: register a profile selecting only the handlers you trust, then run that profile non-interactively from Task Scheduler.
cleanmgr /sageset:42
REM tick: Temporary Internet Files, Temp files, Delivery Optimization,
REM Windows Error Reporting, Thumbnails, Recycle Bin (optional)
cleanmgr /sagerun:42
Server images offer fewer handlers than client builds, and unchecked entries simply do nothing, so a profile copies safely between hosts. Pair it with an explicit temp purge, because cleanmgr leaves locked files alone:
Get-ChildItem $env:TEMP, C:\Windows\Temp -Recurse -Force -ErrorAction SilentlyContinue |
Where-Object { $_.LastWriteTime -lt (Get-Date).AddDays(-3) } |
Remove-Item -Recurse -Force -ErrorAction SilentlyContinue
The three-day age filter is deliberate. Wiping Windows\Temp during a patch or backup can break an in-flight operation; the filter clears accumulated debris and leaves today’s working files.
Logs, dumps and the files nobody owns
IIS keeps a separate log directory per site and, in default configuration, never rotates. A site writing 20 MB a day is seven gigabytes a year, per site. Enable rollover in IIS Manager and delete archives older than the retention your forensics actually needs.
Get-ChildItem C:\inetpub\logs\LogFiles -Recurse -Filter *.log |
Where-Object { $_.LastWriteTime -lt (Get-Date).AddDays(-30) } |
Measure-Object Length -Sum | Select-Object Count, @{n='GB';e={[math]::Round($_.Sum/1GB,2)}}
Get-ChildItem C:\Windows\MEMORY.DMP, C:\Windows\Minidump\* -ErrorAction SilentlyContinue |
Select-Object FullName, @{n='GB';e={[math]::Round($_.Length/1GB,2)}}
Crash dumps are worth exactly one investigation. Copy the file off the host, analyse it, then delete both the full dump and the minidumps — a single full dump on an 8 GB VPS is 8 GB of paid-for disk that will never be useful again. The same logic applies to SoftwareDistribution\Download: stop wuauserv and bits, clear the folder, restart both, and let the next scan rebuild it.
Pagefile, hibernation and reserved space
Three platform allocations can quietly take twenty gigabytes or more: hibernation (sized to installed RAM, meaningless on a server), reserved storage (a fixed update-staging sliver), and a pagefile larger than the workload needs.
powercfg /hibernate off
DISM /Online /Set-ReservedStorageState /State:Disabled
Get-CimInstance Win32_PageFileUsage | Select-Object Name, AllocatedBaseSize, CurrentUsage
Dropping reserved storage frees a couple of gigabytes but makes update staging compete with your data during patching — worth it at 40 GB, not at 100 GB. Pagefile sizing is its own decision: shrinking below the size needed for a memory dump loses crash capture, and too small a file invites allocation failures under pressure. A fixed size of one to one and a half times RAM, capped at 16 GB, suits a general-purpose host.
The scheduled job that keeps it clean
Manual cleanup decays within one patch cycle. Register a weekly task in the quietest hour that writes a transcript and fails loudly rather than silently — when the disk crosses 90 percent again, the log shows which phase stopped shrinking.
$log = "C:\Maintenance\disk-clean-$(Get-Date -f yyyyMMdd).log"
Start-Transcript -Path $log -Append
$before = (Get-PSDrive C).Free
cleanmgr /sagerun:42
DISM /Online /Cleanup-Image /StartComponentCleanup | Out-String | Write-Host
"Reclaimed: {0} GB" -f [math]::Round(((Get-PSDrive C).Free-$before)/1GB,2)
Stop-Transcript
Add a guard clause that exits when free space is already healthy so the task costs nothing on a good week, and alert — not just log — when space is still below 15 percent after a run. At that point cleanup is no longer the answer.
When to stop cleaning and resize instead
Understand the platform constraint: most VPS disks can be extended but never shrunk, and the resize procedure differs per hypervisor. Cleanup buys runway; growing the volume or moving the workload is the structural fix. If a database or user-file archive will grow steadily, size once at provisioning rather than fighting the ceiling quarterly.
Our guide to extending a Windows volume after a VPS disk upgrade walks the partition-extension steps, and the sizing comparison table on the main site shows how much headroom each plan tier actually gives you before cleanup stops being enough.



