Cleanup Windows

Cleanup Windows

There are several temp folders that Windows uses to store "temporary" files, that being said, Windows is not very good at keeping its house in order.

Sophos Cleanup Script
WSUS Updates with PowerShell and PDQ
Wheel of Lunch

There are several temp folders that Windows uses to store “temporary” files, that being said, Windows is not very good at keeping its house in order. So this two line script can be used to do just that!

# Cleans C:\Windows\Temp
# Cleans C:\Windows\Prefetch
# Cleans C:\Documents and Settings\*\Local Settings\Temp
# Cleans C:\Users\*\Appdata\Local\Temp
$tempfolders = @("C:\Windows\Temp\*", "C:\Windows\Prefetch\*", "C:\Documents and Settings\*\Local Settings\temp\*", "C:\Users\*\Appdata\Local\Temp\*"
Remove-Item $tempfolders -force -recurse
 

COMMENTS