This generic method defines if service should run or be stopped.

⚙️ Compatible targets: Windows


tagInformative name.

This parameter is required.

This parameter is required.
scriptBlockDesired state for the resource.

This parameter is required.

Outcome conditions

You need to replace ${tag} with its actual canonified value.

  • ✅ Ok: dsc_built_in_resource_${tag}_ok
    • ☑️ Already compliant: dsc_built_in_resource_${tag}_kept
    • 🟨 Repaired: dsc_built_in_resource_${tag}_repaired
  • ❌ Error: dsc_built_in_resource_${tag}_error


method: dsc_built_in_resource
  tag: VALUE
  resourceName: VALUE
  scriptBlock: VALUE


Apply a given DSC resource to the node.


  • tag parameter is purely informative and has no impact on the resource.
  • ResourceName must be the explicit name of the DSC resource you wish to apply
  • ScriptBlock must be a powershell script in plain text, returning an Hashtable containing the parameters to pass to the resource.

Note that this method can only apply built-in Windows resources. It will not be able to apply an external resource.


If we want to apply a Registry resource. The resourceName used will be Registry And a potential ScriptBlock could be:

 $Ensure      = "Present"
 $Key         = $HKLM_SOFT + "\ExampleKey"

 $table = @{}
 $table.Add("Ensure", $Ensure)
 $table.Add("Key", $Key)
 $table.Add("ValueName", "RudderTest")
 $table.Add("ValueData", "TestData")

Note that all the ScriptBlock will be readable on the Rudder logs or in the policy files.