Skip to main content

Soji Disk Cleaner [WIN] [PVAL]

Summary

Soji is an intelligent yet simple disk cleanup utility that uses both native System.IO file and directory management and COM references to the deprecated cleanmgr tool to tidy up one or more volumes on a Windows system. Datto RMM implementation of the agnostic content Soji

Dependencies

Sample Run

Example 1

Clean all fixed drives with all available cleaners:
Image1

Example 2

Clean the C and F drives:
Image2

Example 3

Clean the C drive including all user Download directories in PowerShell:
Image3

Example 4

Clean all fixed drives with all available cleaners including the following:

  1. All .txt files that start with "Arigatou" under ?:\MyFolder\MySubfolder
  2. All .log files under the user paths ?:\Users<Username>\AppData\MyAppPath\Logs
  3. Any target files must have a last write time greater than 21.5 days.
    Image4

Variables

NameExampleTypeDefault ValueDescription
DrivesC,DStringAll fixed Drives(Default: All fixed drives) A comma-separated list of volume letters to process. (Example: C,D)
AllTrueBooleanFalse(Default: false) Enable all possible cleaning tools (--purge-downloads, --clean-winsxs, --run-cleanmgr, --empty-recyclebin)
Days10.1String7.0(Default: 7.0) The maximum number of days between now and the last write time of files to keep. (Example: 10.1)
PurgeDownloadsTrueBooleanFalse(Default: false) Purge all user Downloads folders.
CleanWinSxSTrueBooleanFalse(Default: false) Enable WinSxS component cleanup.
RunCleanmgrTrueBooleanFalse(Default: false) Enable legacy cleanmgr execution.
EmptyRecyclebinTrueBooleanFalse(Default: false) Empty the recycle bin. May still occur when running the legacy cleanmgr.
WinSxSSeconds600Number300(Default: 300) The number of seconds to wait for WinSxS processing when --clean-winsxs or --all is passed.
JsonTrueBooleanFalse(Default: false) Include JSON file output.
CsvTrueBooleanTrue(Default: true) Include CSV file output.
DebugTrueBooleanFalse(Default: false) Set this flag to enable debug output in the console.
SystemPaths"Temp|.txt$","system32\Temp"Stringnull(Default: null) An optional comma separated list of additional paths to scan for files to clean with regex file filtering.
UserPaths"AppData\Local\Adobe|.log$","AppData\Local\Microsoft"Stringnull(Default: null) An optional comma separated list of additional user paths to scan with regex file filtering.

Implementation

Import the attached component into Datto RMM.

Output

  • stdOut
  • stdError
  • ProgramData_automation\app\soji\sojilogs\

Attachments

Soji Disk Cleaner.cpt