Automatically delete targeted files and folders to free up disk space on Windows endpoints
This Automox Worklet™ removes specified files and folders from Windows endpoints to reclaim disk space and reduce system overhead. You configure the Worklet with target folders and exclusion rules before deployment. The Worklet evaluates each endpoint, identifies the configured directories, and removes files per your settings.
The Worklet supports both system-wide cleanup (like Windows Temp folders) and user-specific cleanup (such as AppData temporary directories). It can delete folder contents while preserving the directory structure, or remove entire folders if needed. You can also configure the Worklet to skip specific file types during deletion.
After files are removed, the Worklet can optionally delete any empty subdirectories that remain, further optimizing your endpoint storage.
Accumulation of temporary files, cache data, logs, and unused content gradually consumes disk space and degrades endpoint performance. Manual cleanup across dozens or hundreds of endpoints is time-consuming and inconsistent. Automating this task keeps every endpoint optimized without requiring IT staff to touch each machine individually.
Cleaning up unnecessary files also reduces the data footprint for backup and disaster recovery operations, which can lower storage costs. Endpoints with cleaner file systems boot faster, launch applications more quickly, and provide better user experience.
The Worklet's flexibility allows you to define exactly what should be deleted, preventing accidental removal of important files or system components.
Evaluation phase: The Worklet checks whether each configured target folder exists and contains files to delete based on your exclusion rules. It inventories user profiles on the endpoint to locate user-specific folders across all logged-in users.
Remediation phase: The Worklet removes files from each folder according to your configuration. If force delete is enabled, it removes the entire folder including subdirectories. Otherwise, it deletes only file contents while preserving the directory structure. It skips any files matching your exclusion list. If configured, it then recursively deletes any empty subdirectories that remain.
Windows 8.1 or later, or Windows Server 2012 R2 and above
PowerShell 3.0 or later
Local administrator permissions to delete files from system folders and user profiles
Configuration of target folders ($targetFolders variable) for system-wide cleanup paths
Configuration of user folders ($userFolders variable) for per-user cleanup paths such as AppData\Local\Temp
Optional file extension exclusions ($exclude variable) to skip specific file types during deletion
After the Worklet completes successfully, your endpoints will have removed files from the specified folders according to your configuration. Disk space previously occupied by temporary files, cache, logs, or other excluded content is now available for productive use. Endpoints typically see improved performance due to reduced file system overhead and increased available storage. You can verify this change through the Automox Activity Log or by checking the endpoint configuration directly.
You can verify the results by checking available disk space, confirming that configured temporary directories are clean, or reviewing the Worklet's execution log. If you configured the Worklet to delete empty subdirectories, those directories are removed as well. User applications and system services continue to function normally since the Worklet avoids deleting files locked by running processes or protected system components.
Run this Worklet on a pilot Windows endpoint and review evaluation output for folder clean up.
Confirm Automox activity logs show successful completion and exit code 0.
Verify endpoint state using checks aligned to evaluation script logic, such as the evaluation and remediation scripts.
Validate remediation effects from script operations such as Get-CimInstance, Where-Object, Test-Path, then rerun evaluation for compliance.


By submitting this form you agree to our Master Services Agreement and Privacy Policy.
Already have an account? Log in
Consider Worklets your easy button
A Worklet is an automation script, written in Bash or PowerShell, designed for seamless execution on endpoints – at scale – within the Automox platform. Worklet automation scripts perform configuration, remediation, and the installation or removal of applications and settings across Windows, macOS, and Linux.

AUTOMOX + WORKLETS™
Uncover new possibilities with simple, powerful automation.
By submitting this form you agree to our Master Services Agreement and Privacy Policy