Jump to content

Cleanup Temporary Files


PaulWTech

Recommended Posts

The Pulseway Automation contains the Builtin "Cleanup Temporary Files" powershell.  I thought it might be worth a conversation.  Here's the current code:

$folders = @("C:\Windows\Temp\*", "C:\Documents and Settings\*\Local Settings\temp\*", "C:\Users\*\Appdata\Local\Temp\*", "C:\Users\*\Appdata\Local\Microsoft\Windows\Temporary Internet Files\*", "C:\Windows\SoftwareDistribution\Download", "C:\Windows\System32\FNTCACHE.DAT")
foreach ($folder in $folders) {Remove-Item $folder -force -recurse -ErrorAction SilentlyContinue}
exit 0

I'm not sure it is worth removing the SoftwareDistribution\Download files?   From what I understand in Windows 10 you have to run, net stop wuauserv   AND  net stop bits  What are your preferences and experience with doing this?

Is it worth adding these locations:  C:\WINDOWS\tmp,  C:\tmp,  C:\temp, %temp%, %tmp%, C:\WINDOWS\ff*.tmp?

Is deleting "C:\Windows\System32\FNTCACHE.DAT" the same as deleting "if exist C:\WINDOWS\ShellIconCache del /f /q "C:\WINDOWS\ShellI~1\*.*"  ?

Can anyone confirm this will work on Windows 7, 8.1 and 10?

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...