Run webgisdr via Windows Tasks Scheduler

525
10
03-22-2024 11:01 AM
GeorgeClark
New Contributor III

We have each part of our portal running on a different machine.

-Arc Server:  Windows Server 2019 Standard, ArcGIS Server 10.9.1

-Portal:  Windows Server 2012 R2 Standard, Portal for ArcGIS 10.9.1

-SQL Server:  Windows Server 2019 Standard, SQL Server 2016

-Data Store:  Windows Server 2012 R2 Standard, Data Store 10.9.1

-Image Server:  Windows server 2012 R2 Standard, ArcGIS Server 10.9.1

-Clients running on Windows 10

SHARED_LOCATION in webgisdr.properties is on a network share, like the following example.

SHARED_LOCATION=\\\\NetworkSharedFolder\\ServerBackups\\portalserver

I can manually run the webgisdr.bat file on the portal server via cmd window, and it completes successfully.

This is the command I use:  webgisdr --export --file .\webgisdr.properties

After things complete, I can see the final file 20240321-180336-PDT-FULL.webgissite in  \\NetworkSharedFolder\ServerBackups\portalserver.

However, when I run the webgisdr.bat file via the Windows Tasks Scheduler, I observe the following.
- webgisdr says it completes successfully
- I can see the temp folder in the Recycle Bin (because it deletes it after completing)
- The webgissite file is missing on the NetworkSharedFolder

I have run the webgisdr.bat via Windows Task Scheduler and the results are always the same.  Some time ago, webgisdr.bat WOULD run via Windows Task Scheduler, but it has not for a while now.

FYI:  We plan to upgrade our ArcGIs system later this year.

Has anyone else experienced this issue, or does anyone else run the webgisdr.bat from a scheduled task?

0 Kudos
10 Replies
JakeSkinner
Esri Esteemed Contributor

Hi @GeorgeClark ,

I use the following script to execute the webgisdr.  Windows Task Scheduler executes the script each night, and the script will execute a BAT file to run the webgisdr.  You may want to try this to see if it gives successful results.

0 Kudos
GeorgeClark
New Contributor III

@JakeSkinner I followed the instructions and watched the video too.  I am experiencing something odd.  I updated my path, adding in the location for the runtime python folder.  In the cmd window at c:\ , when I enter python, it cannot find it.  When I enter webgisdr, it can find it.  Any suggestions?ArcGisPythonIssue 2024-03-28 151614.png

0 Kudos
JakeSkinner
Esri Esteemed Contributor

@GeorgeClark not quite sure on this, but I would simply use the full path to the python.exe when configuring the scheduled task:

JakeSkinner_0-1711710263727.png

 

0 Kudos
GeorgeClark
New Contributor III

Thanks!  I will give that a try.

0 Kudos
HenryLindemann
Esri Contributor

Hi @GeorgeClark , It looks like you have a file permissions issue what you can try is to run as your bat as the service account that is running the portal for ArcGIS, if this fails then this is probably the issue, make sure that this service account has access to your network share and that this account is the one running in task scheduler.

Regards

Henry

 

0 Kudos
GeorgeClark
New Contributor III

Hi Henry, Thank you for your response.  I did not provide this info in my original problem description and I apologize.  I log into the server using the GIS service account, and run the webgisdr.bat file, and the Scheduled Task in Windows Task Scheduler as the GIs service account.  The service account has full privileges on the server and on the network share, where the backups are being stored.  It very puzzling that it works, as the same user, via cmd and not via Scheduled Task.

0 Kudos
MingLee
Esri Contributor

Definitely sounds like there is an issue either with the Windows Share Permissions for \\\\NetworkSharedFolder\\ServerBackups\\portalserver or with the actual permissions on the folder itself. When you run the webgisdr utility manually, via the command line - you're probably using your own login. When the same utility is run via Windows Task Scheduler, it is using either a service account or 'something' else. Check what account it is using and adjust if necessary. For this distributed set up, I would use the same account to run the task as you're using to run the various Portal, ArcGIS Server, Data store services. 

0 Kudos
GeorgeClark
New Contributor III

Hi Ming, Thank you for your response.  See my response to Henry.  I agree with you, and I checked the permissions on the network share.  I log into the server using the GIS service account, and run the webgisdr.bat file, and the Scheduled Task in Windows Task Scheduler as the GIs service account.  The service account has full privileges on the server and on the network share, where the backups are being stored.  It very puzzling that it works, as GIS service account, via cmd but not via Scheduled Task.

0 Kudos
HenryLindemann
Esri Contributor

HI @GeorgeClark, Scheduled Tasks can be problematic sometimes, please have a look under actions did you specify a start in parameter if this parameter has quotes then remove them, also the scheduled task will execute in No-Guie environment so if you have any screen prints comment them out.

Regards

Henry

0 Kudos