Creating groups in bulk

Previously, we have seen bulk creation of users using PowerShell. A similar requirement might come from creating security groups in bulk. The function given in the following code helps in creating groups in a bulk fashion. It creates a security group of a given scope (domain local, global, or universal) inside the default user's container by default. They can be created in different locations in the Active Directory structure by updating the $TargetOU variable's value with the DN of the OU where you want to create them:

Function Invoke-ADBulkGroup { [CmdletBinding()] Param( [Parameter(Mandatory=$true, Position = 0)] [String[]]$GroupName, [Parameter(Mandatory=$true, Position = 1)] [ValidateSet("DomainLocal","Global","Universal")] ...

Get Active Directory with PowerShell now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.