When run as a scheduled task, if the program encounters a file that requires administrative permission to delete, the execution of the application will freeze indefinitely. The scheduled task may be set up to automatically end if it runs more than a certain number of minutes, but this will not kill the DeleteTemporaryFiles.exe from the task manager. As a result, every time the scheduled task runs, a new DeleteTemporaryFiles.exe instance is started, and never completes.