Skip to main content

Soji (Disk Cleanup Utility)

Summary

Soji is a smart yet straightforward disk cleanup utility designed to enhance system cleanliness on Windows. It utilizes both native System.IO file and directory management along with COM references to the deprecated cleanmgr tool.

This document provides a guide on creating the Soji disk cleanup automation in Ninja One.

Please reference Soji for argument usage.

Sample Run

Clean all fixed drives with all available cleaners:

Image1

Clean the C and F drives:

Image2

Clean all fixed drives and read back the file JSON report in PowerShell:

Image3

Dependencies

Parameters

NameExampleAccepted ValuesRequiredDefaultTypeDescription
DrivesC,DStringfalseAll fixed drivesString/TextA comma-separated list of volume letters to process.
AllCheckedCheckboxfalseUncheckedCheckBoxEnable all cleaning tools: purge downloads, clean WinSxS, run cleanmgr, and empty recycle bin.
Days14Integerfalse7.0IntegerThe maximum number of days between now and the last write time of files to keep.
Purge DownloadsCheckedCheckboxfalseUncheckedCheckBoxPurge all user Downloads folders.
Clean WinSxSCheckedCheckboxfalseUncheckedCheckBoxEnable WinSxS component cleanup.
Run cleanmgrCheckedCheckboxfalseUncheckedCheckBoxEnable legacy cleanmgr execution.
Empty RecyclebinCheckedCheckboxfalseUncheckedCheckBoxEmpty the recycle bin.
WinSxS Seconds600Integerfalse300IntegerSeconds to wait for WinSxS processing when Clean WinSxS or All is enabled.
JsonCheckedCheckboxfalseUncheckedCheckBoxInclude JSON file output.
CsvCheckedCheckboxfalseCheckedCheckBoxInclude CSV file output. Required for custom field output.
DebugCheckedCheckboxfalseUncheckedCheckBoxSet this flag to enable debug output in the console.
System PathsC:\Temp\LogsStringfalsenullString/TextOptional comma-separated list of additional system paths to scan with regex filtering.
User PathsAppData\Local\TempStringfalsenullString/TextOptional comma-separated list of additional user paths to scan with regex filtering.

Custom Fields

NameExampleRequiredDescription
cPVAL Soji ResultSoji last run (03/23/2026 16:10) - Results: Removed 1242 files, returned 4.2 GB to the device.trueStores the most recent results of the Soji automation, including a timestamp, file count, and total space recovered.

Automation Setup/Import

Automation Configuration

Output

  • Activity Details
  • Custom Field

Changelog

2026-03-23

  • Updated .Net8 Desktop Runtime installation logic to install the latest available version.
  • Code Signed the PowerShell script.
  • Document modifications.

2025-06-25

  • Updated the script to save the result of Soji cleanup inn the Custom Field "cPVAL Soji Result".

2025-05-06

  • Initial version of the document