I am in the process of migrating a scheduled task from ArcMap to ArcGIS Pro that exports maps to PDFs on a daily basis. I have the python script written, and it executes as expected when running through an IDE (PyCharm) using the python executable delivered with ArcGIS Pro (..\Program Files\ArcGIS\Pro\bin\Python\envs\arcgispro-py3\python.exe).
When I try executing the same script through Windows Task Scheduler, I can tell the script is running because a .txt file is generated to log processes, however, at some point the script is failing as the maps are not being exported. The task scheduler returns a code of 0xFFFFFFFF and I haven't found anything of substance for this code. There are no warnings or errors in the task history either to give any clues.
We have several other tasks that are running just fine using python 2.7 along with ArcMap/ArcGIS Desktop using my domain account, so the username I'm using has sufficient permissions to execute a task.
I also have ArcGIS Pro setup to login automatically, which again, works fine through the IDE. I tried using a Single Use license, with the same result.
If I comment out all the ArcGIS Pro / arcpy functions, the script will execute as expected through Task Scheduler (creates a log, and sends an email). It seems to be specific to the arcpy functions.
Is anyone running a Windows Task Scheduler task using ArcGIS Pro projects successfully? If so, am I missing something? Is there some sort of permission setting I'm missing? Any ideas of where to look...?