When I use Task Scheduler to run a Python script that references an APRX containing our Tracks layer from Location Sharing (Enterprise), and I am NOT logged in, a persistent COM Surrogate is created. I have a script I want to run every 5 minutes but cannot because these COM Surrogates build up and create problems.
I am looking for suggestions to avoid this issue!
Here are our specs:
- ArcGIS Enterprise 11.3 with up-to-date patching
- ArcGIS Pro 3.3.6 or ArcGIS Pro 3.5.2 (same result)
- ArcGIS Pro Named User license, online or offline, or ArcGIS Pro Advanced Single Use license
- Task Scheduler running with highest privileges, whether or not user is logged in
- Task Scheduler referencing C:\Program Files\ArcGIS\Pro\bin\Python\envs\arcgispro-py3\python.exe, pythonw.exe, or C:\Program Files\ArcGIS\Pro\bin\Python\Scripts\propy.bat all have the same result
- User account running Task Scheduler scripts is admin on the machine
- Multi-user, Windows 10 Azure Virtual Desktop running the scripts via Task Scheduler
- COM Surrogate details: C:\Windows\System32\dllhost.exe
The script in question creates polylines from Tracks collected that day and appends them to a referenced feature service. These allow users to see each other's tracks in the field, updated every 5 minutes, which is useful for ensuring complete coverage for our monitoring work. (Tracklines are automatically created from Tracks in AGOL, but sadly this functionality does not exist for Enterprise.) I can just stay logged into the AVD machine at all times to prevent COM Surrogate issues, but I have been told this is not a sustainable solution.