Creating the Management Service Recovery Keys Using DSC

In the last post I used Configuration Manager to remediate missing registry keys. Using PowerShell DSC I can do the same thing quite quickly. In my lab I have disabled the configuration baseline I created earlier and removed all the registry keys.

I have created a new configuration item in PowerShell – it contains the two registry settings I want to remediate.

Configuration DALAutoRecoveryRegistryKey
    {
    param($computername)

    Node $computername
        {
        Registry DALInitiateClearPoolSeconds
            {
            Ensure = "Present"
            Key = "HKEY_LOCAL_MACHINE\Software\Microsoft\System Center\2010\Common\DAL"
            Valuename = "DALInitiateClearPoolSeconds"
            ValueData = "60"
            ValueType = "dword"

            }
        Registry DALInitiateClearPool
            {
            Ensure = "Present"
            Key = "HKEY_LOCAL_MACHINE\Software\Microsoft\System Center\2010\Common\DAL"
            ValueName = "DALInitiateClearPool"
            ValueData = "1"
            ValueType = "dword"
            }
        }
    }

I can then run the configuration and it will create the mof files to use – one per management server.

image

To apply the configuration I use the Start-DSCConfiguration cmdlet and point it to the path containing my mof files.

image

No errors were reported when running this – if I check the registry I can see the keys have been created.

image