Out of Space on Windows? Updates At Fault.

It seems like each time a client comes to me complaining that their hard drive is full it’s for one of two reasons.

  1. Their hard drive is 40GB.
  2. Windows Update creates unnecessary ‘cab’ files and clutters up the Temp directory.

Of course, this is by no means an exhaustive list. However, it just seems to happen most of the time. When you run WinDirStat (Site/Direct Download v1.1.2) the folder with the most content is C:\Windows\Temp. Oftentimes, I see this location taking up >50-100GB of space. Luckily, the fix is very easy. Delete all the cab files in the C:\Windows\Temp folder.

The data isn’t important and can safely be removed. For one, its in a Temp folder. Also, the cab files are just Windows Update download files…so if they really need to be on the system…they will re-download. Only the hope is that next time Windows actually installs them.

I wrote a Powershell script that is meant to be run on a weekly basis and clears up all of the cab files that have an age greater than 1 week. It’s up to you whether to use an RMM or Task Scheduler, or simply run it once.┬áHere’s the one-liner.

Get-ChildItem -Path "C:\Windows\Temp" -Filter "cab*" | Where-Object {$_.CreationTime -lt ((Get-Date).AddDays(-7)) } | Remove-Item -Force

Disclaimer: As a human, I will inevitably make mistakes and get things wrong. If you  notice an error, or have a better solution, please let me know!