Python 3.5.1 script won't run via Windows Task Scheduler when user logged off

16268
79
Jump to solution
06-23-2017 09:14 AM
ShelbyZelonisRoberson
Occasional Contributor III

I have a python 3.5.1 script that uses ArcGIS Pro 1.4.1 to export some layouts to PNGs. The script runs with no problem from Windows Task Scheduler when I check the option "Run only when user is logged on", however, I really need to run the script when I am logged off.  

I'm confused because I have other Python scripts (version 2.7) that run on the same server/user account via Task Scheduler while I am logged off with no problem. I've set them up with the exact same properties as my python 3.5.1 script... the only difference is the path to the python and the fact that the other scripts use ArcMap and not ArcGIS Pro. 

Has anyone else had this issue and found a way to solve it? I've set up everything using a service account on a server with admin privileges. I have the properties in Task Scheduler set to run with the highest privileges as well. 

79 Replies
MichaelVolz
Esteemed Contributor

Has anyone tried upgrading the server running these Windows Scheduled tasks from Windows Server 2012 R2 to Windows Server 2016?  I ask because it does not appear from this thread that the ESRI rep. tested on Windows Server 2012, just Windows Server 2008 and Windows Server 2016.

0 Kudos
City_of_Greenville__SCGIS
New Contributor III

Yep, just tried this and it was successful on Windows 2016.  Seemingly everything else was the same (admin rights, etc.)  I sent a message to our IT dept for some clarity as I'm not sure if there might be something specific to us or if it's specific to Windows 2012.

0 Kudos
ThomasColson
MVP Frequent Contributor

Yes, 2012 by default will not let a normal user schedule a task. You have to change some settings in Group or Local Security Policy. 

0 Kudos
City_of_Greenville__SCGIS
New Contributor III

I'm logged in as the admin though.

0 Kudos
ShelbyZelonisRoberson
Occasional Contributor III

Which version of Pro are you using?

0 Kudos
City_of_Greenville__SCGIS
New Contributor III

Most recent, ArcGIS Pro 2.2.2

ShelbyZelonisRoberson
Occasional Contributor III

All -- I was able to get a development server with Windows Server 2016 installed. Good news - the scheduled task works! I'm using Pro 2.2.3.

MichaelVolz
Esteemed Contributor

Shelby:

My org introduced Anti-Malware software onto all of our Windows Server servers (2003, 2008, 2012, and 2016).  I was using Windows Scheduled Tasks to rebuild address locators with python 2.7 scripts (ArcMap 10.5.1) on a Windows 2012 Server server which stopped working when the Anti-Malware software was placed into production.  After much testing the only solution that would provide the same results was to run Windows Scheduled Tasks to rebuild address locators with python 2.7 scripts (ArcMap 10.7 Pre-Release) on a Windows 2016 Server server.

Windows 2016 Server appears to handle GIS processes with Scheduled Tasks and python better when Anti-Malware software is running on the server, at least for the Anti-Malware software that my org uses.

ABUGIS
by
New Contributor II

To use a service account for utilising ArcGIS Pro; arcpy script via Task Scheduler, I had to log onto the server with this account service account and setup the ArcGIS Pro using the concurrent license we have.

The Task Scheduler would then work using the service account when I was logged on through my own account on the server.

0 Kudos
SStopyak_BruceHarris
New Contributor III

This is an old thread but I want to point out that it still doesn't work at 2.9.2. Especially the part about not being logged in on Pro. If you have a named user license and you aren't logged in on Pro, your scripts will not run. I hope ESRI will spend some time working on the licensing issues. They make it very hard for any user that needs automation to fully migrate from Desktop to Pro. These problems don't exist with Desktop. Unless there is something you absolutely need from Pro's Conda environment (like vector tiles), the best bet is to continue to use desktop's Python27 for your scripted automation.

0 Kudos