DSC Service Resource

Hi,

I am trying to ensure that the Remote Registry Service is always set to Automatic (triggered) with a dependency on the “Remote Procedure Call (RPC)” Service. No matter what I do I am getting a error when trying to generate the MOF that it is not in the correct format or the “Remote Procedure Call (RPC)” Service does not exist.

Here is what I tried:

#Ensure Remote Registry is set to Automatic
	Service RemoteRegistry
	{
		Name = "RemoteRegistry"
		DependsOn = "[Service]RpcSs"
		StartupType = "Automatic"
	}
#Ensure Remote Registry is set to Automatic
	Service RemoteRegistry
	{
		Name = "RemoteRegistry"
		DependsOn = "[Service]Remote Procedure Call(RPC)"
		StartupType = "Automatic"
	}

When I run a Get-Service for RPCSS I get this info:

Name: RPCSS
DisplayName: Remote Procedure Call (RPC)
ServiceName: RPCSS

I know this service exists and I have tried both the name and display name to no avail. Can someone tell me what I am doing wrong here?

Thanks, Ed

So, to begin with, you can’t have two Service resources with the same name - you’ve got them both set to RemoteRegistry.

DependsOn is not a “this service depends on this other service,” which is how you’re trying to use it. DependsOn creates an application order for DSC settings. You haven’t defined a Service resource named “Remote Procedure Call(RPC),” which is why you’re getting an error. Similarly, you’ve not defined a Service resource named RpcSs.

The Service DSC resource does not currently support setting service dependencies.

I realized I had two service resources, I just wanted to show the two ways I was trying to get this to work.

Thanks for the feedback, makes sense.

(it’s late, this question is silly , and I can’t find the delete button. Feel free to ignore)