ArcGIS Portal ListUsers.bat is running continuously when I run the script

687
2
10-18-2021 03:38 AM
Labels (1)
StephanieStedman
New Contributor

Hi everyone I'm looking for help running the ListUsers.bat supplied with ArcGIS Portal.

Having followed the instructions here everything is running fine and I'm getting a nice output as expected. However I have noticed that after entering my username and password and then run the script it seems to run over and over again. I've left the process running for XXX minutes and it is still cycling through and doing this.  It's very odd because I get this message even when creating a new file altogether. And the script does work instantly and creates the new file instantly as I'd expect. 

Ideally I want to add this .bat to my Windows Scheduler and have it run once a month but I'm worried the .bat will just never stop running and continually be producing this error message and I don't want to block up the machine. When I run the script manually on the Server myself I just close the Command Window and be done with it, but if I create a scheduled task I wouldn't know how to add this and don't want it to run forever?

Any thoughts? Do I need to enter my command differently?

I'm no coder, so any answers in laymen's terms please!

Many thanks, 

Steph

The error message is 

Error: Output file already exists.  Provide new file name.

My updated code for listusers.bat

@echo off

..\..\framework\runtime\jre\bin\java.exe -classpath "lib\*;..\..\framework\lib\arcgis-common.jar;" com.esri.arcgis.portal.tools.ManageAccountsTool --listUsers %*
ListUsers --output "\\C:\Temp\PortalUserList.txt" --format detailed

 

 

0 Kudos
2 Replies
StephanieStedman
New Contributor

On further thought, a second question.  How can I save my admin username and password into the .bat file?
When I run the script manually I can enter these details myself, but if I add this as a task to Windows Scheduler I need those parameters to be entered automatically?

0 Kudos
CharlesSanvido
New Contributor

I know its and old post, but we stumbble on the same problem recently.  The help of the tools indicates that a --username and --password can be passed to the tool

CharlesSanvido_0-1711373914823.png

We tested it and it works correctly.  Note that if you wrap it in Windows Scheduler task, the password is in clear text in the command line to execute.  The username used should be a service account with right limited to ArcGIS portal and not a user account.   This comes at the cost of an additionnal portal licence with role Adminstrator (or custom role with sufficient privileges to e able to manage portal users)

0 Kudos