There is a hardcoded path for scheduled tasks cleanup (line 244):
$tasksPath = "C:\scratchdir\Windows\System32\Tasks"
However, the image is mounted to:
$ScratchDisk\scratchdir
Because of this, the script either:
- does nothing (tasks are not removed from the mounted image), or
- may accidentally target the host system if such path exists.
Suggested fix:
$tasksPath = "$ScratchDisk\scratchdir\Windows\System32\Tasks"
Great script, thanks for the work!