How to add an Active Directory group to another using PowerShell scripts?
Read on to know how to add a group object to another group in Active Directory (AD) using PowerShell and how you can get it done easier with ADManager Plus.
- Identify the domain in which the group that is to be modified, is located.
- Create and compile the script for adding the desired group. Execute the script in PowerShell.
- Sample script for adding a group object to another group:
Click to copy entire script
PS C:\> Import-Module ActiveDirectory
New-ADGroup -Name "DemoGroup1" -SamAccountName "DemoGroup1" -GroupScope Global -GroupCategory Security
- Navigate to Management > Group Management > Modify Single Group.
- Select the Domain and the AD Account(s) you wish to add to the group. Then click Apply.
» Start 30-day Free Trial
Although modifying a group with native tools like PowerShell looks simple, it comes with a few limitations:
- PowerShell scripts can be run only from the computers which have the Active Directory Domain Services role installed in them.
- The script has to be rewritten if additional user accounts are to be added.
- Need for a new script, in case multiple groups are to be added.
- The syntax, parameters and iterations need to be correct. A typo or incorrect syntax might be difficult to spot and rectify, especially when the script is a long one.
ADManager Plus helps you perform the same with a few clicks from its web based GUI console with pre-defined reports to list all members of a group and manage them right from the reports. Learn more about it here.
Manage group memberships in bulk with ADManager Plus.
Get 30-day free trial.