Friday, 7 October 2016

What's up with my Config dude?

When you want to know the current configuration of a DSC node you use the very aptly named Get-DscConfiguration cmdlet like so:
PS C:\>Get-DscConfiguration -CimSession $target_node
This cmdlet will execute the Get-TargetResource function for every configured resource on the node and return details on its current state like so:

And life is good until you add a new resource to your configuration, push it to the target node and run the cmdlet again, only to be faced with an ugly exception like this:

I know what you're thinking, "say whaaaat!!". You just want to see what the current config is and because of one dodgy resource you can't see anything - that sucks. However, the solution is quite simple. The words that stand out are key is not a valid property in the corresponding DSC resource schema file. The preceding word (AvailabilityGroupNameDatabase in this case) is the property that the resource Get-TargetResource function is trying to set which is not defined in the schema.mof file for the resource. What you need to do is add the property to the schema.mof file or modify the Get-TargetResource function of the offending resource.

No comments:

Post a Comment