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.
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.
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.
Step 2. Select your CSV file and click Preview
This will validate your CSV and preview the changes.
Step 3. Click Run to process the csv file.
You can verify users where added to the group with this command.
Get-ADGroupMember -Identity "GROUP-NAME" | Select-Object Name, SamAccountName
With the toolkit run the Group Members report and you can search for a group or user.
You can Download Free Trial of the AD Pro Toolkit and test the bulk group membership features.
