Kaseya Community

Disk Cleanup - Analyze

  • Has anyone had success using the Analyze feature? For prospets that I audit their networks I'd like to be able to use CCleaner to Analyze the drives for temp files and report back how much temp data resides on each system. Then based on that I can pass/fail the workstation.

    I know through the GUI I can run the Analyze feature and click the 'Save to Text file' link. But I need to automate that.

    Legacy Forum Name: Disk Cleanup - Analyze,
    Legacy Posted By Username: jfox
  • Ok, here is what i have so far. I use Du.exe from SysInternals to analyze the %temp% directory on the system. I pipe these results to a text file. Now I need to test the text file for the amount of temp data and write a script log based on the results.

    Script Name: DiskClean1-Audit
    Script Description: This script is used to analyze the user temp file during a system audit to show the amount of temp data in the user temp folder. It pipes the results to a temp file and then calls part 2 of the script MTHIS DiskClean2-Audit.

    IF True
    THEN
    Get Variable
    Parameter 1 : 10
    Parameter 2 :
    Parameter 3 : temp
    OS Type : 0
    Write File
    Parameter 1 : c:\mthis\du.exe
    Parameter 2 : VSASharedFiles\du.exe
    OS Type : 0
    Execute Shell Command
    Parameter 1 : #temp#\du.exe -q %temp% >> #temp#\temp.txt
    Parameter 2 : 0
    OS Type : 13
    Execute Script
    Parameter 1 : DiskClean2-Audit (NOTE: Script reference is NOT imported. Correct manually in script editor.
    Parameter 2 :
    Parameter 3 : 0
    OS Type : 13
    ELSE



    My second Script is
    Script Name: DiskClean2-Audit
    Script Description: This is part two of the Disk Cleanup audit script. It will test the log file created in part 1 and then pass/fail the script based on the amount of temp data in the %temp% folder.

    IF Test File
    Parameter 1 : c:\mthis\temp.txt

    THEN
    Write Script Log Entry
    Parameter 1 : Success
    OS Type : 0
    ELSE
    Write Script Log Entry
    Parameter 1 : Fail
    OS Type : 0



    Here is what the text file will contain.

    Files: 129
    Directories: 25
    Size: 6,745,937 bytes
    Size on disk: 6,745,937 bytes

    I want to be able to test the Size on Disk contains bu that doesn't exactly work since the amount of data in this %temp% directory will vary from computer to computer. I want to be able to apply a threshhold saying if it is less than X than it passes but if it is more it fails?

    Any help would be greatly appreciated.

    Legacy Forum Name: Scripts Forum,
    Legacy Posted By Username: jfox