I am currently trying to automate the steps of publishing a map service and create scheduler tasks to allow the maps to publish automatically. Currently my code creates and save the new mxd, Creates a service definition draft of the service, analyzes the draft for errors and if there are no errors the service is published to the arcgis server manager. The script works as expected running the script as a .bat file. However in the Windows Task scheduler the script fails at the line that creates the service definition draft.
The task is already set to "Run with Highest privileges" and "Run whether user is logged on or not"
Does anyone know how to make the script run in the task scheduler?