I was pointed to this thread because I'm having a similar issue. I have a python script that is exporting PDFs from an ArcGIS Pro project. The script works as expected using an IDE (PyCharm) but when I try to migrate it to task scheduler, it will ONLY work when I have 'Run only when user is logged on'. If I change this property to 'Run whether user is logged on or not' it will fail.
The system environment the script is being run on:
OS: Windows Server 2012 R2
Pro Version: ArcGIS Pro 2.0
Pro License Type: Single Use Advanced
Python exe: ..\Program Files\ArcGIS\Pro\bin\Python\envs\arcgispro-py3\python.exe
So...if I'm reading the thread above correctly...starting at Pro 2.0 you should be able to export out documents (PDF, PNG, JPG, etc...) from a layout...which again, I can confirm is doable, but ONLY if the task is set to 'Run only when user is logged on'. Is there no way to execute this when the user is not logged on?