Creating Multiple Groups in Active Directory using Powershell.

Some times you may need to create multiple Groups (Security or Distribution*) in a short period of time. The most efficient way to achieve this is with the help of "The Windows Servers Administrator Best Friend", PowerShell; more precisely using the "Active Directory Module" for PowerShell. More information about this module can be found here.

First, need to create a .csv file with a single "name" column and add the exact name of all the groups you want to create. (For this exmaple we will call the csv file "bulk-groups" and save it under C:.

After that just use the following script. I recommend to use PowerShell ISE, so you can edit before running.

$groups = Import-Csv ‘c:\bulk-groups.csv‘
foreach ($group in $groups) {
New-ADGroup -Name $group.name -Path “OU=OUGroups,DC=theramdon,DC=zone” -Description “New Groups” -GroupCategory <Security> <Distribution> -GroupScope <Global> <Universal>
}
Show Comments