winreagent_cleanup.ps1 - limehawk/rmm-scripts GitHub Wiki
winreagent_cleanup.ps1
Clean up WinRE agent temporary files.
Overview
Deletes the C:$WinREAgent folder which contains temporary Windows Recovery Environment update files. This folder can consume significant disk space and is safe to delete after WinRE updates are complete.
Purpose
Reclaims disk space consumed by temporary WinRE update files on managed Windows endpoints.
Prerequisites
- Windows 10/11
- Admin privileges recommended
Configuration
Required Inputs
- FolderPath: Path to WinREAgent folder (default: C:$WinREAgent)
Settings
- Deletes folder recursively if it exists
- Hidden/system folder deletion handled
Behavior
- Checks if C:$WinREAgent folder exists
- If exists, deletes folder and all contents
- Reports result
Security Notes
- No secrets in logs
- Only deletes specified system folder
Exit Codes
- 0: Success (folder deleted or not found)
- 1: Failure
Example Output
[ INPUT VALIDATION ]
--------------------------------------------------------------
Folder Path : C:\$WinREAgent
[ OPERATION ]
--------------------------------------------------------------
Checking for WinREAgent folder...
Folder found, deleting...
[ RESULT ]
--------------------------------------------------------------
Status : Success
Action : Folder deleted
[ SCRIPT COMPLETED ]
--------------------------------------------------------------
Version History
- v1.0.0 (2025-11-29): Initial Style A implementation
Links
- View Script Source
- Scripts - Back to script index