The exception itself is coming from Maya. It looks like the API has change slightly in the last few versions. You should be able to replace the last two lines of the script with:
JonasSorgenfrei Another thing, when i change the Server Type from Shared Server (deprecated) to Service i get the issue cmd command not found.
Does anyone has an working example of services with maya ?
Current PDG does not support running Maya as a service out of the box, although the plan is to have that finished for H20.5. It would technically be possible to write your own custom Maya-based service and use it with the block in H20, which is why the option is still available on the block.