INTRODUCTION

When adding a bulk of groups to different Active Directory group you should use Powershell. Use the script in this post to accomplish this.

SOLUTION

This script simply adds the users specified in the Users column in to the groups specified in the Groups column in the CSV.

Grab the script and an example CSV from the TechNet Gallery.

The script is also available below:

BEGIN{
    #Checks if the user is in the administrator group. Warns and stops if the user is not.
    If (-NOT ([Security.Principal.WindowsPrincipal] [Security.Principal.WindowsIdentity]::GetCurrent()).IsInRole(`
        [Security.Principal.WindowsBuiltInRole] "Administrator"))
    {
        Write-Warning "You are not running this as local administrator. Run it again in an elevated prompt."
	    Break
    }
    try {
    Import-Module ActiveDirectory
    }
    catch {
    Write-Warning "The Active Directory module was not found"
    }
    try {
    $Users = Import-CSV $CSV
    }
    catch {
    Write-Warning "The CSV file was not found"
    }
}
PROCESS{

    foreach($User in $Users){
        try{
            Add-ADGroupMember $User.Group -Members $User.User -ErrorAction Stop -Verbose
        }
        catch{
        }

    }
}
END{
 
}

RELATED POSTS