Select to view content in your preferred language

How to publish a Map service using the Windows Task Scheduler?

2886
12
04-03-2018 10:37 AM
ToniSlyer
Emerging Contributor

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?

0 Kudos
12 Replies
JohannaMeyer1
New Contributor

You can use VBSCRIPT and paste into field calculator

CStr([LATITUDE]) + CStr([Longitude])

0 Kudos
deleted-user--MMnVrog9xw_
Deactivated User

Which version of python are you running the script with? This may be unrelated, but I had a problem where the arcpy.StageService_server() function was not working with 64 bit Python 2, but when I switched to 32 bit Python 2 it worked. 

0 Kudos
MelissaGayley
Emerging Contributor

It is my understand that when using Task Scheduler all file paths need to be UNC instead of letter network drives. Thus in line 26 instead of 

con = 'D:\Temp\ArcGIS Connection\ArcGISAdminConnection.ags'

it should be

con = '\\Server\Temp\ArcGIS Connection\ArcGISAdminConnection.ags'

This is discussed for a slightly different script at Stack Overflow. I would check the rest of the script for any other mapped network drive paths. Once I put in UNC paths that solved my similar problem.