I apply the configuration and turn off only one service viz "AppReadiness". Now i execute Test-DSCConfiguration command as follows
$myvar=Test-DscConfiguration -ComputerName "DESKTOP-2F446SK" -Detailed | select ResourcesNotInDesiredState
As you can see when i print the contents of $rnids representing "resources not in desired state", I dont see the actual service name instead i see the instance name as "Resource0::[ServiceSet]myserviceset"
Question: How do i get the actual servicename that is not in the desired state when i use ServiceSet resource. This problem applies to all resource sets such as "ProcessSet", "WindowsFeatureSet", "WindowsOptionalFeatureSet", "GroupSet" etc.
Any help is highly appreciated.
I'm not sure you can. The idea with the set is that it's atomic – it's a single all-or-nothing unit; breaking it down into components defeats the "set" concept. If that's what you need, you'd do individual settings.
#reports all resources in desired and not-destired states in a single table
#capture resources not in desired state from Test-DSCConfiguration result
#expand the property
#we are only interested in some columns so pick only those
#create a mapping of all ResourceID->Name from the current applied configuration
[array] $final= @()
$final | ft
You must be logged in to reply to this topic.