Thursday, June 7, 2012

Powershell and Active Directory: Add domain users to a group using powershell.



Yesterday i shows you how to create a user group in "Active Directory". Now lets today add members to that user group using powershell.

Lets Start.

 Make sure you have "RSAT" installed on you laptop.

Now Import the Active Directory module.

Import-Module ActiveDirectory

30-04-2012 23-21-03 


ok, Module is imported,,

we are going to use Add-ADGroupMember cmdlet.

so we have a user group name as "Singers" which currently have no members.

07-06-2012 13-48-43

i am am planning to add "Michal Jackson" and "Rickey Martin" to the group.

07-06-2012 13-56-49

the command is below. Add-ADGroupMember and then Name of the Group and after that {SamName} name of the users delimitated by comma. and you can also provide -Server name if you want.

Add-ADGroupMember Singers Ricky.martin,Michael.jackson -Server "LocalDC"

07-06-2012 14-12-46

our command run successfully now lets check the Group see if our users are added to it..

07-06-2012 14-10-44

Bingo !! All DOne ...

Thanks for reading.


Aman Dhally

Buy-More-Twitter-Followers   4fb29548b6adc


No comments:

Post a Comment