Hello,
I have written a python script that modifies datasets in a geodatabase that is within a mapped network drive. I want this script to run on a schedule so a specific field gets populated consistently (this is what the script does). The issue I have been having is running the task in MS Task Scheduler with the "Run whether user is logged on or not" checked. It returns the following error: "Task Scheduler failed to start "\ScriptName" task for user "Domain/User". Additional Data: Error Value: 2147943726."
When I run the same task but with "Run only when user is logged on" selected, it works fine.
Here's a list of what I have already tried:
-creating a batch file to access the network drive using "net use" (with user and pass stored in MS Credential Manager) then calling the script and python.exe interpreter for arcpro
-same batch file but instead of python.exe, used proenv.bat, but this just opened the command window and set the environment to python without running the script
-use UNC paths for all paths to network files (the datasets in the gdb and the batch and python files themselves in the network)
-had the batch file stored locally to run and access network drive from within the batch file then run the python script
-mapped the drive from within Task Scheduler when choosing the batch or python file as action
-used python.exe file as Action and .py script as Argument
The drive is a shared drive among the organization and this gdb needs to be updated within the shared drive so I cannot work locally. I also want it to be able to run overnight when I am not on site or logged into the computer.
My user is an Administrator and has Batch run access.
Any ideas that would help this run in Task Scheduler would be greatly appreciated.
Following this
Schedule geoprocessing tools—ArcGIS Pro | Documentation
worked when set up as reported here
Solved: How to schedule a task to run when computer is log... - Esri Community
Is that what you have been following?
Hi Dan - yep I followed both of those, but still get the same error message.
Can you just try running a simple script of a print statement followed by importing arcpy module and then another print statement to see if any print statements get executed. I had an issue where anti-virus software was blocking arcpy python from executing.
Testing the simple script worked fine when running it with "run only when user is logged on" checked, but when I switch it to "run whether user is logged on or not" it fails to connect to the user.
I had a similar issue, so I set the ArcGIS Pro License from Named user to Concurrent user and point to our License Manager Server then add the Service user account as a local admin on the server and it went through. Not sure if that'll work for you but try that?
Unfortunately my organization does not have concurrent user licenses
It sounds to me as if the problem is a Windows user permissions issue. Consult your IT folks about the necessary permissions for running scheduled tasks when you are not logged in.