Adding members to a group

In the previous sections, we saw how to create groups in Active Directory, how to search for them, and how to change group object information. Groups are useless without members in them. In this section, we will concentrate on how to add both user accounts and computer accounts to security groups in Active Directory.

Like any other operation, Active Directory module has a cmdlet to add members to groups. The Get-ADGroupMember cmdlet does this for you.

To add a member to the group, use the Add-ADGroupMember cmdlet with the member parameter. Use the samaccountName of the member/user for ease of addition.

Adding user accounts to groups

Adding a single user account to a security group is very straightforward with the Add-ADGroupMember ...

Get Active Directory with PowerShell now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.