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.

WSUS Updates with PowerShell and PDQ
Deprecating TLS 1.0 and TLS 1.1
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