Windows Server disks fill up gradually: update leftovers, logs, temp files, user profiles, and application caches. On a VPS with a fixed disk, running out of space breaks updates, databases and RDP logons. Here’s how to find what’s using space, and clean it safely.

1. See what’s using space

Get-Volume | Select-Object DriveLetter, @{n='SizeGB';e={[int]($_.Size/1GB)}}, @{n='FreeGB';e={[int]($_.SizeRemaining/1GB)}}

Find the largest folders (PowerShell, may take a while):

Get-ChildItem C:\ -Directory -Force -ErrorAction SilentlyContinue | ForEach-Object {
  $size = (Get-ChildItem $_.FullName -Recurse -File -Force -ErrorAction SilentlyContinue | Measure-Object Length -Sum).Sum
  [pscustomobject]@{Folder=$_.FullName; GB=[math]::Round($size/1GB,2)}
} | Sort-Object GB -Descending | Select-Object -First 10

Graphical tools such as WizTree or TreeSize Free are much faster on large disks.

2. Clean the component store (WinSxS)

C:\Windows\WinSxS stores components, including superseded update versions. Never delete files from it manually. Use DISM:

Dism /Online /Cleanup-Image /AnalyzeComponentStore
Dism /Online /Cleanup-Image /StartComponentCleanup

To also remove superseded versions permanently (you can’t uninstall existing updates afterwards):

Dism /Online /Cleanup-Image /StartComponentCleanup /ResetBase

See Windows Server SFC and DISM.

3. Windows Update download cache

Stop-Service wuauserv, bits -Force
Remove-Item C:\Windows\SoftwareDistribution\Download\* -Recurse -Force -ErrorAction SilentlyContinue
Start-Service wuauserv, bits

Windows re-downloads what it still needs.

4. Temp files

Remove-Item "$env:TEMP\*" -Recurse -Force -ErrorAction SilentlyContinue
Remove-Item "C:\Windows\Temp\*" -Recurse -Force -ErrorAction SilentlyContinue

Files in use are skipped. That’s fine.

Disk Cleanup (cleanmgr) is available on Desktop Experience (and on Server Core after installing the Desktop Experience feature on older versions). Run cleanmgr /sageset:1 once to choose categories, then cleanmgr /sagerun:1. Storage Sense (“Settings → System → Storage”) is available on newer versions.

5. Logs

IIS logs grow forever by default:

Get-ChildItem C:\inetpub\logs\LogFiles -Recurse -Filter *.log |
  Where-Object LastWriteTime -lt (Get-Date).AddDays(-30) | Remove-Item -Force

See IIS logs. Also check application logs (SQL Server error logs and backups, trading platform logs, custom app logs), and the CBS log folder (C:\Windows\Logs\CBS).

6. User profiles

Old RDP user profiles can be several GB each. Remove profiles of users who no longer use the server via System Properties → Advanced → User Profiles → Settings, or:

Get-CimInstance Win32_UserProfile | Where-Object { -not $_.Special -and $_.LastUseTime -lt (Get-Date).AddDays(-90) } |
  Select-Object LocalPath, LastUseTime
# review, then remove with: | Remove-CimInstance

Downloads folders and browser caches inside profiles are other common space hogs.

7. Other large items

  • Page file (pagefile.sys): sized by Windows; don’t disable it to save space. See Windows Server page file.
  • Hibernation file (hiberfil.sys): servers rarely need hibernation: powercfg /hibernate off.
  • Memory dumps (C:\Windows\MEMORY.DMP, C:\Windows\Minidump): delete after analysis.
  • Old installers and backups left in Downloads or on the desktop.
  • Local backups that should be off the server anyway. See Windows Server Backup.

8. Automate it

Put the safe steps (temp, logs older than N days, update cache) into a script, and run it weekly with Task Scheduler. See Windows scheduled tasks with PowerShell. Add a check that alerts you when free space drops below 15%.

When cleanup isn’t enough

If the disk is legitimately full of data you need, move bulk data elsewhere, or upgrade to a plan with more disk. See VPS storage planning and when to upgrade your VPS.

Quick reference

Area Command
Free space Get-Volume
Component store Dism /Online /Cleanup-Image /StartComponentCleanup
Update cache stop wuauserv → clear SoftwareDistribution\Download
Temp Remove-Item $env:TEMP\*, C:\Windows\Temp\*
IIS logs delete files older than 30 days
Hibernation powercfg /hibernate off

Related: Windows Server performance tuning and Windows VPS.

  • Windows Server
  • Storage
  • Maintenance