Fix Windows VPS Disk Full | Free C: Drive Space with PowerShell

Updated on Oct 29, 2026
Kimberly N
10 MINS READ
Table of Contents
Free Disk Space on a Windows VPS

A Windows VPS disk full error usually shows up without warning. Apps fail to save data, updates stop, and sometimes you cannot even log in. If you see "not enough disk space" on your Windows VPS, the C: drive is usually the problem. Most Windows VPS plans start with a small C: drive, and Windows fills it quickly.

Common Causes of a Full C: Drive on Windows VPS

A full C: drive does not happen by chance. A few things fill it again and again, and most of them stay hidden until the disk is full. These are the most common causes:

  • Windows updates: Every update adds files. Old copies stay on disk in C:\Windows\WinSxS and C:\Windows\SoftwareDistribution.
  • WinSxS: This is the component store. It keeps the files Windows needs for updates and repairs. It grows over time.
  • Logs: IIS, CBS, and app logs grow every day if nobody removes them.
  • Temp files: Installers and apps leave files in C:\Windows\Temp and in each user's temp folder.
  • Memory dumps: After a crash, Windows can save C:\Windows\MEMORY.DMP, which can be several GB.
  • Pagefile: C:\pagefile.sys is a hidden file that can be as large as your RAM or more.

Most guides say to run Disk Cleanup. That tool needs a GUI, and it is usually missing on Windows Server. This guide uses only PowerShell and DISM, so it works on any RDP-limited server.

For this guide, run every command in PowerShell as Administrator. If you want more speed tips after the cleanup, you can read our guide to optimize Windows VPS performance.

Step 1: Check Your Free Disk Space

Before you fix a Windows VPS disk full issue, you must check how much space you have. Remember to save the free space in a variable, so you can compare at the end.

To check the C: drive free space, run the following command in PowerShell:

Bash
$before = (Get-PSDrive C).FreeGet-PSDrive C | Select-Object Name,  @{n='UsedGB';e={[math]::Round($_.Used/1GB,2)}},  @{n='FreeGB';e={[math]::Round($_.Free/1GB,2)}}

The output will show UsedGB and FreeGB for C:. Write down FreeGB. Keep this same PowerShell window open until the last step, because $before is lost when you close it.

Step 2: Find What Uses the Space

Now you know how much free space you have. You must find out what is using it. If you delete files without checking, you can remove the wrong thing and miss the real problem. In this step, you can rank the biggest folders and files on the C drive. Then, you know exactly where to clean.

Run the command below. This can take a few minutes on a large disk:

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

In the output, you must see the top 10 folders with their size in GB. Pick the biggest one and look inside it the same way. Use the folder path in place of C:\.

Next, find the 20 biggest single files with the command below:

Bash
Get-ChildItem C:\ -Recurse -File -Force -ErrorAction SilentlyContinue |Sort-Object Length -Descending | Select-Object -First 20 FullName,  @{n='SizeMB';e={[math]::Round($_.Length/1MB,1)}}

Look for files like MEMORY.DMP, large .log files, .bak files, or old installers. Also, check the pagefile size with:

Bash
Get-CimInstance Win32_PageFileUsage | Select-Object Name, AllocatedBaseSize

AllocatedBaseSize is in MB. Leave the pagefile alone. Windows needs it.

Step 3: Safe vs. Unsafe Files to Delete on a Windows VPS

Not every big file is safe to remove. Some files are only temporary, and Windows can make them again. Others are needed to start Windows, install updates, or run your apps. Deleting them can break your server. Use the table below to check each item before you delete it.

Item Location Action
User temp files %TEMP% Safe to delete
System temp files C:\Windows\Temp Safe to delete
Windows Update download cache C:\Windows\SoftwareDistribution\Download Safe to delete (stop the update services first)
Old IIS logs C:\inetpub\logs\LogFiles Safe to delete if older than 30 days
Memory dumps C:\Windows\MEMORY.DMP, C:\Windows\Minidump Safe to delete if you are not debugging a crash
Recycle Bin C:\$Recycle.Bin Safe to empty
WinSxS C:\Windows\WinSxS Clean only with DISM. Never delete by hand
Pagefile C:\pagefile.sys Do not delete
Installer cache C:\Windows\Installer Never delete. It breaks repairs and uninstalls
System files C:\Windows\System32 Never delete
Database files .mdf, .ldf, .bak Never delete unless you have a backup and know what they are

Step 4: Clean Temp Files, Update Cache, and Dumps

These steps free disk space on a Windows VPS quickly, even in a Windows VPS disk full emergency. First, clean the temp folders with:

Bash
Remove-Item "$env:TEMP\*" -Recurse -Force -ErrorAction SilentlyContinueRemove-Item "C:\Windows\Temp\*" -Recurse -Force -ErrorAction SilentlyContinueGet-PSDrive C

Files that are in use are skipped. This is normal.

Then, clear the Windows Update download cache. Stop the services, delete the files, and start the services again:

Bash
Stop-Service wuauserv, bits -ForceRemove-Item "C:\Windows\SoftwareDistribution\Download\*" -Recurse -Force -ErrorAction SilentlyContinueStart-Service bits, wuauservGet-PSDrive C

Windows downloads the files again if it needs them. Now remove old memory dumps and error reports:

Bash
Remove-Item "C:\Windows\MEMORY.DMP" -Force -ErrorAction SilentlyContinueRemove-Item "C:\Windows\Minidump\*" -Force -ErrorAction SilentlyContinueRemove-Item "C:\ProgramData\Microsoft\Windows\WER\ReportQueue\*" -Recurse -Force -ErrorAction SilentlyContinueClear-RecycleBin -DriveLetter C -Force -ErrorAction SilentlyContinueGet-PSDrive C

Check the Free in the output; it should be higher than before.

Step 5: Delete Old Log Files

Log files grow every day, and nobody notices until the disk is full. IIS and Windows update logs are the most common ones. Old logs are rarely needed, so you can remove them safely. You can delete only the logs that are older than 30 days and keep the recent ones:

Bash
Get-ChildItem "C:\inetpub\logs\LogFiles" -Recurse -File -Filter *.log -ErrorAction SilentlyContinue |Where-Object LastWriteTime -lt (Get-Date).AddDays(-30) |Remove-Item -ForceGet-PSDrive C

Then, remove old CBS logs, which are Windows update logs:

Bash
Get-ChildItem "C:\Windows\Logs\CBS" -File -Filter *.log -ErrorAction SilentlyContinue |Where-Object LastWriteTime -lt (Get-Date).AddDays(-30) |Remove-Item -ForceGet-PSDrive C

Step 6: Clean WinSxS on Windows Server with DISM

The WinSxS folder is usually one of the biggest folders on a Windows Server. It keeps the files Windows needs for updates and repairs, and it grows with every update. Do not delete anything from it manually, because this can break Windows. Use DISM instead. It removes only old files that Windows no longer needs.

First, see if a cleanup is needed with the command below:

Bash
DISM /Online /Cleanup-Image /AnalyzeComponentStore

Look for the line Component Store Cleanup Recommended. If it says Yes, run the cleanup:

Bash
DISM /Online /Cleanup-Image /StartComponentCleanupGet-PSDrive C

This can take several minutes. Do not close the window.

Also, you can add /ResetBase. It frees more space, but you can no longer uninstall the updates that are already installed. Use it only if the server has been stable for a few weeks:

Bash
DISM /Online /Cleanup-Image /StartComponentCleanup /ResetBaseGet-PSDrive C

File Explorer usually shows a bigger WinSxS size than the real one, because many files are shared with Windows. The AnalyzeComponentStore command shows the real size.

Step 7: Verify Your Free Disk Space

The cleanup is done, so now you must check the result. In Step 1, you saved your free space in the $before variable. Compare it with the free space you have now, and you see exactly how much space you got back:

Bash
$after = (Get-PSDrive C).Free"Freed: {0} GB" -f [math]::Round(($after - $before)/1GB,2)Get-PSDrive C

Here is an example from a test server with a 60 GB disk. Your numbers should be different:

Check Free space on C:
Before cleanup 2.1 GB
After temp, cache, dumps, and logs 9.4 GB
After DISM component cleanup 12.8 GB

Fix Windows VPS Disk Full When RDP Login Fails

Sometimes the disk is so full that you cannot log in with RDP at all. Windows needs a little free space to start your session, so the login fails. You can still fix this without RDP. In this section, you use the provider console or remote PowerShell to free up a few GB, then log in as usual.

Option 1: Use the Provider Console

You can open your PerLod control panel and use the VNC or console option. It does not need free disk space for a session on your side. Sign in, open Command Prompt, type powershell, and run the cleanup. You can start with this quick command to get a few GB back:

Bash
Remove-Item "C:\Windows\MEMORY.DMP" -Force -ErrorAction SilentlyContinueGet-PSDrive C

Option 2: Use Remote PowerShell

This works only if WinRM (port 5985) is open on the server. Run this on your PC as Administrator. Replace SERVER_IP with your server IP:

Bash
Set-Item WSMan:\localhost\Client\TrustedHosts -Value "SERVER_IP" -ForceEnter-PSSession -ComputerName SERVER_IP -Credential Administrator

The prompt changes to [SERVER_IP]: PS C:\...>. Now you can run Get-PSDrive C, and then run the cleanup commands.

Extend the Disk After a Plan Upgrade

If cleaning is not enough, or a Windows VPS disk full error keeps coming back, you need a bigger disk. Here is how to extend the disk on your Windows VPS. 

First, you must upgrade your plan. Then, your provider adds the new space to the disk. Windows does not use it until you extend the C: partition.

Refresh the disk info and look at the limits with:

Bash
Update-HostStorageCacheGet-Disk | Select-Object Number, @{n='SizeGB';e={[math]::Round($_.Size/1GB,1)}}, @{n='UnallocatedGB';e={[math]::Round($_.LargestFreeExtent/1GB,1)}}Get-PartitionSupportedSize -DriveLetter C

UnallocatedGB should show the new space. If it shows 0, the disk was not increased yet. Contact support or restart the server and check again.

Now you can extend the C: drive to the largest possible size:

Bash
$max = (Get-PartitionSupportedSize -DriveLetter C).SizeMaxResize-Partition -DriveLetter C -Size $maxGet-Partition -DriveLetter CGet-PSDrive C

Check the Size in Get-Partition and the total of Used plus Free in Get-PSDrive C. They should match your new plan size. If the command says the size is not supported, another partition, for example, a recovery partition, may sit right after C:. In that case, ask support for help before you change any partition.

The cleanup helps for a while, but a bigger disk is the real fix. If your apps grow quickly, you can look at the Windows VPS plans with more NVMe storage.

Set Up a Daily Disk Usage Check

To stop a Windows VPS disk full error from coming back, you can make a small script that writes a warning to the Windows Event Log when C: is 85% full or more:

Bash
New-Item -ItemType Directory -Path C:\Scripts -Force@'$limit = 85$d = Get-PSDrive C$usedPct = [math]::Round(($d.Used / ($d.Used + $d.Free)) * 100, 1)if ($usedPct -ge $limit) {  if (-not [System.Diagnostics.EventLog]::SourceExists('DiskAlert')) {    New-EventLog -LogName Application -Source 'DiskAlert'  }  Write-EventLog -LogName Application -Source 'DiskAlert' -EventId 5001 -EntryType Warning -Message "Drive C: is $usedPct% full."}'@ | Set-Content C:\Scripts\Check-DiskSpace.ps1Get-Content C:\Scripts\Check-DiskSpace.ps1

Then, create a scheduled task that runs it every day at 8 AM:

Bash
$action  = New-ScheduledTaskAction -Execute 'powershell.exe' -Argument '-NoProfile -ExecutionPolicy Bypass -File C:\Scripts\Check-DiskSpace.ps1'$trigger = New-ScheduledTaskTrigger -Daily -At 8amRegister-ScheduledTask -TaskName 'DiskSpaceAlert' -Action $action -Trigger $trigger -User 'SYSTEM' -RunLevel HighestGet-ScheduledTask -TaskName 'DiskSpaceAlert'

Check that the task state shows Ready. To test it, change $limit = 85 to $limit = 1 in the script, run the task, and read the event:

Bash
Start-ScheduledTask -TaskName 'DiskSpaceAlert'Start-Sleep -Seconds 5Get-WinEvent -FilterHashtable @{LogName='Application'; ProviderName='DiskAlert'} -MaxEvents 1 | Format-List TimeCreated, Message

Change the limit back to 85 after the test. You can also connect this event to your monitoring tool, or add Send-MailMessage to the script if you have an SMTP server.

Conclusion

A Windows VPS disk full problem is easy to fix when you follow a clear order. Find the big items, clean the safe ones, run DISM for WinSxS, and extend the disk when you need more space. Check Get-PSDrive C after every step, and keep the 85% alert running, so you see the problem early. If your server keeps running low, a bigger plan is the best long-term fix.

We hope you enjoy this guide. To learn more about extending a partition, read the official Resize-Partition (Storage) documentation on Microsoft Learn.