Created
March 1, 2018 16:16
-
-
Save mu88/156a630b8f98fcfe8f4fe60448a3bbea to your computer and use it in GitHub Desktop.
ArcPy - Create ArcGIS Server Connection File
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import arcpy | |
servers = ['myServer1', 'myServer2', 'myServer3'] | |
outdir = 'GIS Servers' # using 'GIS Servers' results in creating the AGS files in the 'GIS Servers' section of ArcCatalog (equivalent to '%appdata%\ESRI\Desktop10.5\ArcCatalog') | |
username = '' | |
password = '' | |
for server in servers: | |
out_name = server + ' (admin).ags' | |
server_url = 'https://' + server + '/arcgis/admin' | |
print "Creating '" + out_name + "'" | |
arcpy.mapping.CreateGISServerConnectionFile("ADMINISTER_GIS_SERVICES", | |
outdir, | |
out_name, | |
server_url, | |
"ARCGIS_SERVER", | |
username=username, | |
password=password) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment