Bulk Creating Active Directory groups

Share on:

One of my colleagues gave me a list of AD groups for the sharepoint environment he’s confguring. Instead of creating them manually I used the Quest ActiveRoles management shell.

1import-csv 'SecurityGroups.csv' | foreach {  
2New-QADGroup -Parent \$\_.ParentContainer -Name \$\_.Name -sAM
3\$\_.Name -GroupScope \$\_.GroupScope -GroupType \$\_.GroupType  
4}

This script imports a .csv file to create the security groups. The .csv file contains the OU distinguished name, the group Name, the group type (security or distribution) and finally the scope (Domain Local, Global or Universal).

It looks like this:

Parentcontainer,Name,Grouptype,GroupScope
“OU=Sharepoint,DC=domain,DC=local”,SecurityGroup01,Security,DomainLocal