xPSDesiredStateConfiguration icon indicating copy to clipboard operation
xPSDesiredStateConfiguration copied to clipboard

xGroupSet - using DependsOn results in compilation error

Open rdavisunr opened this issue 8 years ago • 4 comments

I am using the resource as follows:

xGroupSet AddgMsaToLocalGroups
{
    GroupName = $ADData.gMsaLocalGroups
    Ensure = "Present"
    MembersToInclude = $GroupManagedServiceAccount
    Credential = $DomainAdminCreds
    DependsOn = "[Script]CreateGmsaAccount"
}

This results in the following error:

The format of the resource reference '' in the Requires list for resource '[xGroup]Resource0::[xGroupSet]AddgMsaToLocalGroups' is not valid. 
A required resource name should be in the format '[<typename>]<name>', with alphanumeric characters, spaces, '_', '-', '.' and '\'.

The error only occurs if DependsOn is set.

rdavisunr avatar Mar 27 '18 17:03 rdavisunr

I label this as bug and help wanted so someone in the community can debug this.

johlju avatar May 15 '18 13:05 johlju

@johlju @rdavisunr is this still an bug? or is there a work around for that? We are still seeing the issue.

saiprasanthrajavarapu avatar Nov 05 '19 20:11 saiprasanthrajavarapu

@saiprasanthrajavarapu - I have not tried any versions beyond 8.1.0.0. So, can't confirm myself.

As far as a workaround, I ended up doing something like this:

ForEach($groupName in $ADData.gMsaLocalGroups)
{
    xGroup "$($NodeName)-Join-$($groupName.replace(' ', ''))"
    {
        GroupName = $groupName
        Ensure = "Present"
        MembersToInclude = $GroupManagedServiceAccount
        Credential = $DscDomainAdminCreds
        DependsOn = "[Script]InstallGmsaAccount"
    }
}

rdavisunr avatar Nov 05 '19 22:11 rdavisunr

I also just encountered this, and just as rdavisunr discovered, it only seems to be a problem with the "set" versions of the resources. The normal resources works fine. Specifically i had problems around the "xWindowsOptionalFeatureSet" resource.

zlepper avatar Jun 18 '20 19:06 zlepper