Skip to content
statance
MenuClose
← All troubleshooting guides

Windows Server C: drive is full

Windows

Check free space with Get-PSDrive, then find large folders with PowerShell. Safe cleanups are the component store (DISM /StartComponentCleanup), IIS logs in C:\inetpub\logs, temp folders and Windows Update download cache. Do not delete WinSxS contents by hand.

Symptoms

  • C: shows very little free space
  • Windows updates fail to install
  • Applications or SQL Server fail to write files

How to diagnose it

  1. Check free space

    Used and Free are in bytes; the second command shows GB.

    Get-PSDrive -PSProvider FileSystem Get-CimInstance Win32_LogicalDisk | Select-Object DeviceID, @{n='FreeGB';e={[math]::Round($_.FreeSpace/1GB,1)}}, @{n='SizeGB';e={[math]::Round($_.Size/1GB,1)}}
  2. Find the largest top-level folders

    Can take a while on a large drive.

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

    Reports whether cleanup is recommended.

    Dism.exe /Online /Cleanup-Image /AnalyzeComponentStore

Common causes and fixes

Component store (WinSxS) with superseded updates

Clean it with DISM. Do not delete files in WinSxS manually.

Dism.exe /Online /Cleanup-Image /StartComponentCleanup

IIS logs never cleaned

Delete old logs and schedule a cleanup task.

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

Temp files

Remove old files from the Windows and user temp folders.

Get-ChildItem $env:windir\Temp, $env:TEMP -Recurse -Force -ErrorAction SilentlyContinue | Where-Object LastWriteTime -lt (Get-Date).AddDays(-7) | Remove-Item -Recurse -Force -ErrorAction SilentlyContinue

SQL Server backups or transaction logs on C:

Move backups to another drive and set a retention policy; back up the log (FULL recovery) so log files can be reused.

Page file or hibernation file

Servers rarely need hibernation; disabling it removes hiberfil.sys.

powercfg /hibernate off

Prevent it happening again

  • Alert when DISK_used is above 85%; the Windows agent reports every disk.
  • Keep data, logs and backups off the system drive.

Set it up: Windows Server monitoring.

FAQ

Can I delete the WinSxS folder?

No. Use DISM /StartComponentCleanup to remove superseded components safely.

Is it safe to delete C:\Windows\SoftwareDistribution\Download?

Yes, after stopping the wuauserv service. Windows Update downloads files again if needed.

Related guides

Get alerted before this becomes an outage.

Install the agent in one line. Statance watches CPU, memory, disk and services, and its AI assistant helps find the cause.