Windows Temp Folder Getting Full

Modified on Mon, 3 Nov at 10:49 AM

A disk gets full, and there are many large files in C:\Windows\Temp. This is due to large CBS logs. Run this script to clear the Temp files and also delete the CBS logs.

# Stop the Windows Modules Installer (TrustedInstaller)
Stop-Service TrustedInstaller -Force

# Clear the temporary .cab files
Remove-Item -Path C:\Windows\Temp\cab_* -Force -ErrorAction SilentlyContinue

# Clear all CBS log files
Remove-Item -Path C:\Windows\Logs\CBS\* -Force -ErrorAction SilentlyContinue

# Start the Windows Modules Installer service
Start-Service TrustedInstaller

Write-Host "Cleanup complete."


Was this article helpful?

That’s Great!

Thank you for your feedback

Sorry! We couldn't be helpful

Thank you for your feedback

Let us know how can we improve this article!

Select at least one of the reasons
CAPTCHA verification is required.

Feedback sent

We appreciate your effort and will try to fix the article