Search code examples
powershellactive-directorywindows-server-2008-r2active-directory-group

Add a group to members of a group in PowerShell


I would like to add a group to members of another group using PowerShell. I have seen a way to do that with vbscript but is it possible to do it with powershell?

My environment:
-Windows Server 2008 R2
-PowerShell 2.0


Solution

  • One way is using ActiveDirectory module:

    Import-Module ActiveDirectory
    
    Add-ADGroupMember -Identity <samaccountname of destination group> -Members <samaccountname of group to add in>