Bulk Add Users to Groups in Active Directory

Updated

Bulk Add Users to Groups in Active Directory

Need to add a large number of users to Active Directory groups? In this guide, I’ll show you how to bulk add users to groups using PowerShell, a CSV file, and the AD Pro Toolkit. I’ll cover adding multiple users to a single group, adding one user to multiple groups, and bulk operations from CSV.

How to Add Multiple Users to a Group from CSV

You can use the Add-ADGroupMember PowerShell command to add multiple users to a group.

Step 1. To add a large number of users to a group, create a CSV file with a SamAccountName header and a list of the users logon names.

Save the file as users.csv. Here is an example csv file.

CSV file with a SamAccountName column listing the users to add

Step 2. Run the following script. Change the path and the GROUP-NAME.

Import-Csv "C:\users.csv" | ForEach-Object {
    Add-ADGroupMember -Identity "VPN Users" -Members $_.SamAccountName
    Write-Host "Added $($_.SamAccountName) to VPN Users" -ForegroundColor Green
}

The script will write the results as it processes the csv file.

Script output confirming in green each user added to the group

AD Pro Toolkit Method

The AD Pro Toolkit includes several AD Group Management Tools to simplify group management. You can easily bulk add or remove users from groups.

Step 1. To bulk add users to a single or multiple groups download the included template and enter the user and group details.

Toolkit CSV template with user and group columns filled in

Step 2. Select your CSV file and click Preview

This will validate your CSV and preview the changes.

Preview validating the CSV and listing the membership changes to be made

Step 3. Click Run to process the csv file.

Results after running the CSV, showing the outcome for each user

You can verify users where added to the group with this command.

Get-ADGroupMember -Identity "GROUP-NAME" | Select-Object Name, SamAccountName
Get-ADGroupMember output listing the group's members after the import

With the toolkit run the Group Members report and you can search for a group or user.

Group Members report with a search box for finding a group or user

You can Download Free Trial of the AD Pro Toolkit and test the bulk group membership features.