I am trying to make a quick script to report dead layers within an mxd, e.g. layers who point to a bad location in a database or to a web service that is no longer active.
I am having a hard time finding a way to get the name of the service. I would like to get the layer name from the TOC, the url of the server, and the name of the service.
Looking at the layer properties I don't see a way to get the name of the service for Map Service type.
mxd_path = r"xxxx"
#mxd = arcpy.mapping.MapDocument("CURRENT")
mxd = arcpy.mapping.MapDocument(mxd_path)
brknList = arcpy.mapping.ListBrokenDataSources(mxd)
dead_layer_info = 
for brknItem in brknList:
dead_layer_info.append((brknItem.name, brknItem.datasetName, brknItem.dataSource))
elif brknItem.supports("SERVICEPROPERTIES") and not brknItem.supports("DATASOURCE"):
service_prop = brknItem.serviceProperties
url = service_prop.get("URL", "N/A")
# name = service_prop.get("Name???", "N/A")
dead_layer_info.append((brknItem.name, " ", url))
dead_layer_info(brknItem.name, " ", " ")
dead_layer_info = list(set(dead_layer_info))
for row in dead_layer_info:
print ", ".join(row)