I'm using the code below to publish an image service, works fine. But I need to be able to delete the existing service before creating the new one with the same name (or alternatively I'd like to overwrite the existing one with the new one). Does anyone know the proper code to delete an image service, or else the required adjustment to have this overwrite the existing image service? Thanks!
# Define local variables:
MDWorkspace = "K:\Image Server Cache\VIMS\CCRM" # the folder for mosaic dataset and the service defintion draft file
ConnectionFileWorkspace = "C:\Users\dschatt\AppData\Roaming\ESRI\Desktop10.5\ArcCatalog"
GDBpath = os.path.join(MDWorkspace,GdbName) #File geodatabase used to store a mosaic dataset
Name = "SCHISM_Data"
Md = os.path.join(GDBpath, Name)
Sddraft = os.path.join(MDWorkspace, Name + ".sddraft")
Sd = os.path.join(MDWorkspace, Name + ".sd")
con = os.path.join(ConnectionFileWorkspace, "arcgis on mobjack.vims.edu_6080 (publisher).ags")
print "Creating SD draft"
arcpy.CreateImageSDDraft(Md, Sddraft, "SCHISM_48HoursData", 'ARCGIS_SERVER', con, False, "VIMS_CCRM", None, "SCHISM, 48HoursData")
print "Service successfully published"