Monday, June 11, 2012

Powershell and Active Directory: Powershell Script to create multiple groups in Active Directory and add predefined users in to it.


Sometime a need arrives when you need to create a few Active Directory groups and add the same members to all the groups.

Today i need to create 20 Group and need to add same users to all the groups. To create 20 Group manually and then add users to it one by one is a hectic job for me .

So again i thought let do it with PowerShell.

To achieve my goal i wrote a simple Powershell script. Make sure before running the script Make sure you have "RSAT" installed and imported the "Active Directory" Module.

You can download the script from :

In testing OU i have only one Group Now.

11-06-2012 16-19-22

Run the script now and it ask you for Domain Administrator username and password.

11-06-2012 16-20-59

Ok...Script is finished with some Messages :)

11-06-2012 16-31-39

lets check our OU  and it has 4 New Groups.

11-06-2012 16-33-02

Lets Check inside the groups.

11-06-2012 16-33-15 11-06-2012 16-33-28 11-06-2012 16-33-46 11-06-2012 16-34-00 

All is well and done as per our requirements.

You can download the script from :

Aman Dhally
Buy-More-Twitter-Followers   4fb29548b6adc

No comments:

Post a Comment

Note: Only a member of this blog may post a comment.