How to bulk create AD Groups [Powershell]
- Adam Ibrheam
- Jun 12, 2021
- 1 min read
Overview - You can use the following Powershell Script to quickly create security groups in Active Directory. The use of scripts such as this allows you to quickly make changes, deploy objects, and perform other tasks in one go.
I like to keep all static variables at the start of any script I do. This way it is easier to change them if needed.
I am using a variable for the Distinguished Name of the OU I want the groups to be created in. I am also using a variable for the location of the .csv file I have created.
Please note, you can change the Group Category and Group Scope to something different if needed. This is just my example:
Script -
############################
## Script to bulk create AD Groups
## By Adam
############################
#Static Variables
$OU = “OU=Security Groups,OU=IT,DC=blizzardtech,DC=com”
$ADCSV = Import-Csv "C:\Users\adam\Desktop\ADGroupList.csv"
#Import AD Module
Import-Module ActiveDirectory
#Loop through each row of the CSV and create the groups
foreach ($ADName in $ADCSV) {
New-ADGroup -Name $ADName.name -Path $OU -Description $ADName.Description -GroupCategory Security -GroupScope DomainLocal
}
CSV Example -

Finished Example -
This is a screenshot for the Active Directory Users and Computers console





Comments