How to Bulk Modify Active Directory User Attributes

In this article, you will learn how to bulk modify Active Directory user attributes using PowerShell and the AD Pro Toolkit. Both options will use a CSV file to bulk update AD User accounts.

In this article

Bulk Modify AD User Attributes with PowerShell

In this example, I’ll use the set-aduser cmdlet to update AD User attributes.

Step 1. Create CSV File

You need a CSV file with a list of users and the attributes you want to update. For example, I’m going to bulk update the description, job title, department, company and office attribute for multiple users. I’m using the users samaccountname in column A to identify the accounts to update.

CSV Example.

csv file

Step 2. Create and Run Script

The script below puts everything from the CSV into a hashtable. If you are updating different attributes just modify the hashtable section with your attributes.

$Users = Import-Csv -Path C:\it\BUlkModifyUsers.csv

ForEach ($User in $Users) { 
     
    #Let's create a hashtable of attributes to update our user with
    $Attributes = @{
          Description =   $User.Description
          Title =              $User.title
          Department =  $User.Department
          Company =      $User.Company
          Office =            $User.Office
    }

    Set-AdUser -Identity $user.samAccountName @Attributes

    
    Write-host $User.samAccountName "has been updated" -ForegroundColor Cyan
}

Open PowerShell and run the script. I saved both my csv file and script into c:\it folder on my computer.

powershell update attributes script

Thats it, pretty easy right? You can then use PowerShell to list all of the attributes for the user to verify they updated.

 Get-ADUser -filter * -Properties * | select name, description, title, department, company, office | format-table
powershell verify attributes

Easily Bulk Modify AD User Attributes with AD Pro Toolkit

The AD Pro Toolkit is a collection of Active Directory Tools to simplify and streamline Active Directory management. The included Bulk Modify Users tool makes it easy to update and remove user attributes.

Step 1. Download CSV Template

Click on Bulk Modify Users and then download the template.

modify user tool

Fill out the template with the user accounts and attributes you want to update. In this example, I will modify several attributes at once including adding users to groups and setting a manager.

  • Tip #1 = You can remove columns from the template that you don’t need.
  • Tip #2 = You can use the included user export tool to export accounts and attributes you want to update to a CSV. This makes it easier to create a template.

CSV Example.

csv example 2

Step 2. Run Bulk Update Users Tool

Select your CSV file and click run.

run bulk update users tool

The toolkit will output how many accounts were updated and show and errors. As you can see the toolkit makes it very easy to bulk update AD attributes and requires no PowerShell scripting. Download AD Pro Toolkit and try it for free.

Bulk Remove User Attributes

In the previous example, I showed you how to mass update user attributes but what if you want to bulk remove user attributes?

No problem.

The process is almost the same, just add the LDAP attribute to the CSV and for the value put remove.

I’ll remove the values for the employeeid and employeenumber.

clear user attributes

Now just run the tool, select the CSV and click run.

I’ll verify the changes in ADUC.

verify user attribute removed

Looks good the values have been removed.

To verify with PowerShell use this command.

Get-ADUser -filter * -Properties * | select employeeid, employeenumber
powershell verify all attributes removed

Bonus! You can remove and update values at the same time.

There comes a time when every administrator faces the need to make bulk changes to Active Directory user accounts. I have faced this challenge several times and have struggled with it in the past. With the AD User Bulk Update Tool this is no longer a problem for me or my team to deal with. This tool makes it very easy and saves a great amount of time when dealing with modifying user accounts.

This tool is included in the AD Pro Toolkit. You can download a free trial here. 

Related Articles