Kaseya Procedure to Delete Windows Temp Files

I have been trying to create a script to delete these files and subfolders for a long time now. The Files/Subfolders I am speaking of are located in C:\Windows\Temp\.

I was able to create a VBScript very simply to delete these files but the locked files will not delete, even though I am logged in as full admin. I have procedures to run disk cleanup and ICSweep as well as CCleaner but none of these delete the files I need.

Not a direct answer, but an option. You mention you tried CCleaner, was it the "free" version? I believe their Business Edition has some advantages including multi-profile cleaning (not just the active user) and "advanced lock detection".. but whether that translates to deleting them I am not sure. They have a Kaseya integration with a free trial, www.greaterintell.com/CCleaner.html might be worth a try.

You have posted to a forum that requires a moderator to approve posts before they are publicly available.

I am running this now. It did a good job at clearing what I wanted so that's a GREAT start. However, it is loud to the user as in it has to run prompts on the screen. Is there any way for the internet temp files to be deleted silently?

You have posted to a forum that requires a moderator to approve posts before they are publicly available.

I have not looked into trying to make that part silent since I run this as part of a new agent install and during troubleshooting a system it has not been an issue for me. I am not sure if it would be possible to make silent at least not using the steps I am using right now.

You have posted to a forum that requires a moderator to approve posts before they are publicly available.

Okay jmaque, looks really good but I changed 2 things and added a third. You were deleting c:\temp, not just the contents either, so I changed that a bit since a lot users have data in the folder that really isn't temp (shame on them). I also changed the procedure to, at the end, delete the .vbs from c:. Lastly, we have had a lot of issues with C:\Windows\Logs\CBS filling up. I added the command to delete this as well. In all, this solved my issue! THANKS!

You have posted to a forum that requires a moderator to approve posts before they are publicly available.

Glad my script fit your needs.. I cant take complete credit for it though as the vbs is NOT mine. Original author is credited in the vbs, I simply modified a few liens in the vbs. I will be adding the CBS logs to my script though, as i just checked a couple of machines of mine and each had at least 1GB of logs.

You have posted to a forum that requires a moderator to approve posts before they are publicly available.

I have a kaseya script that runs only kaseya code that cleans up the following folders/files older than 15 days, and empties the trash. Additional folder paths can be easily added. On average this script clears 10+gb

I really like this script in the option to send email after procedure runs, since i have a 3rd party that needs to know hard drive space after script runs. However I am receiving the following error when running. "FAILED in processing THEN step 53, Get Variable, with error File Open Failed, Get content from file c:\kworking\scripts\win_logs\DiskB4.log (Line 61)"

Thanks in advance for any help

You have posted to a forum that requires a moderator to approve posts before they are publicly available.