Book Image

Active Directory with PowerShell

By : Pamarthi Venkata Sitaram, YELLAPRAGADA U PADMAVATHI
5 (1)
Book Image

Active Directory with PowerShell

5 (1)
By: Pamarthi Venkata Sitaram, YELLAPRAGADA U PADMAVATHI

Overview of this book

Table of Contents (16 chapters)
Active Directory with PowerShell
Credits
About the Author
About the Reviewers
www.PacktPub.com
Preface
Index

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 cmdlet, as shown in the following command:

Add-ADGroupMember –Identity "Group1-Read" –Members LabUser1

Multiple users can be added to security groups by passing their names to the -Members attribute as shown in the following command:

Add...