Kaseya Community

Problem running Disk Clean Up Script

  • I have written two scripts. One to copy Wise Disk Cleaner Portable to the working directory and a second script to run from the command line to do the actual disk clean up. The second script is: executeShellCommand (c:\atsworking\wisediskcleaner.exe -a, "Execute as System", "All Windows Operating Systems", "Halt on Fail")

    The script shows running successfully and does clean up some files. However, if I login to the machine and run the command from the command line, it will find a lot more items to delete so obviously the script is not running correctly. When you do run the script from the command, the program does open its GUI console so it may be that it is not doing it when I try it from Kaseya.

    Thanks for your help.


  • I would guess you will get better results running as user when users are logged in.  I have noticed cleaners like this don't get much when run as system.

  • Procedure Windows Disk Cleanup.xml

    I am actually in a similar situation with Microsofts built in Disk Utility (cleanmgr.exe).  The newish option to clean up old Windows Update files works perfectly while I am at the machine, but even run as user doesn't work from Kaseya.

    All I did was update Kaseya's canned Windows Disk Cleanup procedure with this bit:

    <Statement name="SetRegistryValue" continueOnFail="false">
    <Parameter xsi:type="StringParameter" name="RegistryPath" value="HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\VolumeCaches\Update Cleanup\StateFlags0001"/>
    <Parameter xsi:type="StringParameter" name="Value" value="2"/>
    <Parameter xsi:type="EnumParameter" name="DataType" value="Integer"/>
    And make it x64 compatible.  I found that if I run this script and then another to make a Scheduled Task, and manually run the scheduled task it works... not sure about when the Task actually kicks off on its own yet though.