/build/static/layout/Breadcrumb_cap_w.png

What scripts do you use to clean up hard drive space on your Windows machines?

I’m exploring the automating of freeing up hard drive space on our Windows pcs using Kace SMA (k1000) scripting. Are there scripts any of you have used yourself or would recommend to one looking to free up HD space on remote (kace agent) machines?


Thanks for your time.



0 Comments   [ + ] Show comments

Answers (3)

Posted by: Nico_K 1 week ago
Red Belt
1

this runs once a month on all (windows) machines:

  1. Launch “$(KACE_SYS_DIR)\cmd.exe” with params “/c rd c:\windows\temp\* /s /q”.trashcan-icon.png
  2. Launch “$(KACE_SYS_DIR)\cmd.exe” with params “/c rd $(KACE_DATA_DIR)\patches\* /s /q
Posted by: rodwyer 1 week ago
Senior Yellow Belt
1

Nice. That gives me a good entry point and a model to add further scripts. Thanks!

Posted by: JordanNolan 1 week ago
10th Degree Black Belt
0

I do something similar, but use a GPO.  I use the Shutdown event for computer and LogOff event for user so I do not clear any temp files in use:

Under Computer -> Policy -> Windows Settings -> Scripts I have a Shutdown.bat script

del /q "C:\Windows\Temp\*"
FOR /D %%p IN ("C:\Windows\Temp\*.*") DO rmdir "%%p" /s /q

Under User -> Policy -> Windows Settings -> Logoff I have a Logoff.bat script

del /q "%localappdata%\Temp\*"
FOR /D %%p IN ("%localappdata%\Temp\*.*") DO rmdir "%%p" /s /q

I also have a scheduled task set to run monthly to perform a diskcheck.
CMD.exe /c "ECHO Y|chkdsk c: /f"(You need the ECHO Y to tell the chkdsk command Yes to perform the check on the next reboot)
 
This website uses cookies. By continuing to use this site and/or clicking the "Accept" button you are providing consent Quest Software and its affiliates do NOT sell the Personal Data you provide to us either when you register on our websites or when you do business with us. For more information about our Privacy Policy and our data protection efforts, please visit GDPR-HQ