Service DSC resource should not have a default $State
The Service DSC resource defaults to state = running. It would be great to be able to say "I want to make sure the service is installed, but I don't care what state it's currently in."
Thanks for the feedback!
We will take this into consideration in a future release.
It seems like improving the Service resource would be a better option than writing a new one that could install/uninstall a service, make sure it pointed to the correct path, runs as the proper account, has the right startup type, etc - since the Service resource already does all those things. It would be nice for the end-user to choose which attributes of the service were in the desired state, just like startup type is an optional attribute.
There's also no indication in the documentation (https://msdn.microsoft.com/en-us/powershell/dsc/serviceresource) that state has a default value, and it's listed as optional.
Sebastian N. commented
I don't think that it as a good idea. The Service resource is meant to ensure that a service is in a specific state and not that a service exists. A file resource or script resource would be more appropriate for what you're trying to achieve.