AnsweredAssumed Answered

Stopping and Starting Services in Portal via Python

Question asked by brianmcleer on Jan 8, 2020
Latest reply on Jan 9, 2020 by agelfert

Trying to start/stop specific services. Using the article at How To: Stop GIS services using ArcGIS API for Python, I tried using the code but keep receiving an error message below posted code. I am running this script in IDLE (ArcGIS Pro). Using just IDLE for ArcGIS Desktop did not have the necessary modules. 


from arcgis.gis import GIS
import arcgis.gis.admin
gis = GIS("", "Username", "Password", verify_cert=False)
services =
#To stop specific service(s)
for service in services:
for service in
if == "SampleWorldCities":


Error Message: 


Traceback (most recent call last):
File "Z:\Temp\Brian\", line 5, in <module>
services =
NameError: name 'gis_servers' is not defined