Remove-ScreenConnectFiles
Description
Removes all but the newest ScreenConnect version folder from the ScreenConnect working directory (C:\WINDOWS\SystemTemp\ScreenConnect). ScreenConnect leaves a version-named folder behind on every client update, and the accumulating folders are being flagged by SOC tooling.
Usage
- Verifies the ScreenConnect working directory exists.
- Enumerates the immediate child folders and keeps only those whose names are valid version numbers (e.g.
25.1.10.9197). Any folder that is not a version number is logged and left untouched. - Sorts the version folders newest-to-oldest and retains only the single newest one. If more than one folder resolves to the newest version, only one is kept.
- Removes every other version folder.
Removes every ScreenConnect version folder except the newest one.
.\Remove-ScreenConnectFiles.ps1
Output
.\Remove-ScreenConnectFiles-log.txt
Changelog
2026-07-07
- Initial version of the document.