Prerequisites: Active Directory, PowerShell, ActiveRoles Management Shell for Active Directory

Setup: You have access to a domain member computer in a Active Directory domain

Problem: You have a text file with many group names and you want to create them quickly

Solution: Open ActiveRoles PowerShell console and run these commands:

$file = gc c:\groupnames.txt # group names 1 per line
$file | %{New-QADGroup -ParentContainer "OU=TestOU,DC=domain" -name $_ -samaccountname $_ -GroupScope DomainLocal}

Tips 1: If you want to work in another domain connect to it first:

connect-qadservice fqdn.of.the.domain -credential $cred

Tips 2: An easy method to find out the full DN of an OU, for parent container for example:

Get-QADObject <OUname> | select dn

Leave a Reply

Your email address will not be published. Required fields are marked *