Python script to re-publish a MXD as a service and keep all the service settings

558
2
04-28-2017 04:29 AM
AdrianMarsden
Regular Contributor II

Hi


I've found lots of scripts that take a MXD and publish it, or take a sddraft file.  However these all seem to create a new service with the default settings.  I really need a script that replicates the "Share As>>Map Service>>Overwrite and existing service" menu options in Desktop.

It would be nice if at the end of this Wizard there was an option to save what you have as a sddraft, as at that point it has picked up all the settings from the existing service.

Have I missed something here?

Cheers


ACM

0 Kudos
2 Replies
JonathanQuinn
Esri Frequent Contributor

This is a good idea to submit as an enhancement, as there isn't as easy way to do this outside of python.  If you were familiar with Python, you can get the properties for the service prior to publishing, publish the new service, and apply the original settings.  You can also modify the SD draft file as it's XML and update whatever settings you need to.

0 Kudos
AdrianMarsden
Regular Contributor II

Yes, I seen some scripts that alter the draft file XML, I may look at those - in the mean time it is back to logging on on Sunday mornings to update services :(

0 Kudos