Author Posts

November 4, 2016 at 11:55 am

How can I to import all the members of a universal distribution group in Active Directory into a security group? in many cases there are nested distibution groups. How can I get the members of each nested group?
I mean I will get recursive Group Membership of Distribution Group and all members import to the SG

Here is my command :

Get-ADGroupMember -Identity distributiongroup | ForEach-Object { Add-ADGroupMember -Identity securitygroup -Members $_ }

Error Message:

    Add-ADGroupMember : A global group cannot have a universal group as a member
    At line:1 char:124
    + Get-ADGroupMember -Identity "distribution_group" | ForEach-Object { Add-ADGroupMember < <<<  -Identity "SG_users" 
    -Members $_ }
        + CategoryInfo          : NotSpecified: (SG_users:ADGroup) [Add-ADGroupMember], ADException
        + FullyQualifiedErrorId : A global group cannot have a universal group as a member,Microsoft.ActiveDirectory.Management.Commands.AddADGroupMember

November 4, 2016 at 12:24 pm

There isn't a need to do a foreach. Add-ADGroupMember has a Members property that is expecting a collection, so try this:

Add-ADGroupMember -Identity SECURITYGROUP -Members (Get-ADGroupMember -Identity DISTRIBUTIONGROUP)

If there is a Universal Group nested in the Distribution Group, then the error is accurate.

November 4, 2016 at 12:47 pm

I am getting same error message Add-ADGroupMember : A global group cannot have a universal group as a member