© 2021 www.richardwalz.com
Richard Walz
All rights reserved.

Run a Batch file using Task Scheduler on a Terminal Server

Have you ever needed to run a task on a terminal server?  I have many times.  In one particular case we needed to run a batch file within the Task Scheduler but were having inconsistent issues when the particular user account was not logged onto the server.  The task refused to run even if the designated properties were set on the task scheduler itself.

After extensive logging I was able to determine the exact issue and then had to determine a fix.  Although not as straight forward as one would hope this did resolve the issue for the application we were trying to launch.  In some instances this may not be required but for us in order to launch WinSCP it was.

Solution:

  1. Create your task in Task Scheduler with the following options

2. From the Run command type “gpedit.msc” this will open the local policy settings.  Navigate to the following location, then double click on “Log on as a batch job”

3. Add the user to this listing that is set to run the task within Task Scheduler.  This will allow the task to run the task whether the user is logged in or not.

4. Finished!  Your task should run properly with or without the user being logged in.