How to Bulk Modify Active Directory User Attributes

Are you looking for a quick and easy solution to bulk modify Active Directory user attributes?

Then you are in the right place.

In this post, I’m going to show you the AD Bulk User Update Tool that makes it easy to bulk update active directory user attributes.

This is a PowerShell tool that updates AD user attributes from a CSV.

The best part!

It doesn’t require any PowerShell knowledge, it’s a complete module. You just install it, launch it, select the CSV file and you’re done. Very easy!

Let’s jump right into some examples:

    1. Bulk Modify Users Office Attribute
    2. Bulk Modify User Department and Title
    3. Bulk Update User Employee ID and Employee Number
    4. Bulk Remove User Attributes
    5. Understanding LDAP Attributes (Cheat Sheet)

Example 1: Bulk Modify Users Office Attribute

In this example, I’m going to mass update the department attribute for 100 users. If there is a value already present it will get updated.

The AD Bulk User Modify tool uses a CSV file to bulk modify Active Directory user accounts.  All you need is the users sAMAccountName and the LDAP attribute you want to modify.

If you are not familiar with LDAP attributes you may want to jump to the LDAP attributes section for a quick overview. I’ve created an LDAP cheat sheet to quickly find the correct LDAP values.

Step 1: Setup the CSV File

The first column of the CSV file needs to be the sAmAccountName followed by the list of users you want to modify.  The next column needs to be the attribute you want to modify followed by the value.

TIP: The Active Directory names do not always match the LDAP attribute name. This is how Microsoft designed it. This can be confusing and is why I created a cheat sheet showing the most common Active Directory names to LDAP attribute names. See the end of this post for the cheat sheet.

Looking at the cheat sheet the LDAP attribute for office is physicalDeliveryOffice.

You can see below I have my CSV file setup and ready to import. I’ll just save it to my computer and move to step 2. (You can name the file whatever you want it just needs to be a CSV file).

Step 2: Run AD Bulk User Modify Tool

Now the easy part.

Open PowerShell and run the command below to execute the tool

set-adattribute

It will prompt you to select the CSV file. Browse and select the CSV file and click open. As soon as you click “open” the tool will run against the CSV file.

 

As the tool runs through the CSV it outputs to the console the progress.

It’s really fast! I just updated the office attribute for 100 users in 7 seconds.

Step 3: Verify the results

This is optional but follow these steps to verify the changes.

You can open each account in ADUC to see the changes but that can be very time consuming if you updated a lot of accounts.

With PowerShell, we can quickly verify the changes and filter the results to display only the values changed.

Get-ADUser -filter * -Properties * | select name, office

Looks great!

I can see the test users account office attribute has been updated to the value I set in the CSV file.

Example 2: Bulk Update User Department and Job Title

In this example, I will update the department and title attribute at the same time. You can modify as many attributes at once as you wish.

Again, if a value is already set it will be overwritten.

I look at the LDAP cheat sheet and see I need attributes department and title.

Now, I’ll setup the CSV file.

Ready to go, now I’ll just open PowerShell and run the command

set-adattribute

The tool runs and makes the changes set by the CSV file.


Once it’s complete I’ll run the below command to verify everything has been updated correctly. Get-ADUser -filter * -Properties * | select department, title

Perfect!

I just modified the department and job title for 100 users in 15 seconds.

Example 3: Bulk Update User Employee ID & Employee Number

In this example, I’ll update the Employee ID & Employee Number values for my 100 test accounts.

These two values only show up in the attribute editor, the values do not show up on any of the tabs in Active Directory Users and Computers.

The LDAP attribute names are employeeID and employeeNumber.

I’ll update my CSV with the LDAP attribute name and set the values I want.

Now I’ll run the tool to update the attributes.

Once it has completed I’ll verify the changes with the below PowerShell command.

Get-ADUser -filter * -Properties * | select name, employeeid, employeenumber | sort name

Looks good.

In about a minutes worth of work, I just updated the employeeid and employeenumber on 100 accounts.

Example 4: Bulk Remove User Attributes

The first three examples 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 department and job title values for my 100 test accounts.

Now just run the tool and select the CSV file.

I’ll verify the values have been removed with the below command

Get-ADUser -filter * -Properties * | select department, title

Fantastic!

The values have been removed.

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

Understanding the LDAP Attribute Names (LDAP Cheat Sheet)

Active Directory stores details about objects such as users into LDAP attributes. These attributes are basically a key value pair for example:

givenName = Robert

GiveName is the attribute name and Robert is the value.

This is the method Active Directory uses to store details about objects.

Here is where it gets a little confusing and is why I created the LDAP cheat sheet.

The fields names you see in Active Directory Users and computers do not always match the LDAP attribute name.

For example, in ADUC the First Name field has an LDAP attribute value of giveName

Below is a table of the most commonly used ADUC fields and the LDAP attribute mappings. I’ve grouped them based on the ADUC tabs General, Address, Profile, Telephones, and Organization.

You can use this to quickly lookup what LDAP attribute name to setup in the CSV file.

LDAP Attribute Cheat Sheet

This is a downloadable PDF.

The AD Bulk modify tool is not limited to the table above, again those are just common fields. The AD Bulk Modify tool will update any LDAP attribute.

You can use the attribute editor on any account to find other attributes you may need to bulk update.

Screenshot of the attribute editor on an account, this lets you see all the attributes.

You can also use PowerShell to view the LDAP attributes.

Change username to the account you want to view

Get-ADUser username -Properties *

Final Thoughts

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 myself or my team has to deal with. This tool makes it very easy and saves a great amount of time when dealing with modifying user accounts. The great part about this tool is that it does not require any PowerShell experience. I have some Windows Admins on my team that are not familiar with PowerShell, but they were able to install this tool and use it with no issues.

Recommended Tool: SolarWinds Server & Application Monitor (SAM)

This utility was designed to Monitor Active Directory and other critical applications. It will quickly spot domain controller issues, prevent replication failures, track failed logon attempts and much more.

What I like best about SAM is it’s easy to use dashboard and alerting features. It also has the ability to monitor virtual machines and storage.

Download Your Free Trial of SolarWinds Server & Application Monitor. 

2 Comments

  1. mario on April 2, 2019 at 8:52 am

    by me:
    The term ‘set-adattribute’ is not recognized as the name of a cmdlet, function, script file, or opera
    ble program. Check the spelling of the name, or if a path was included, verify that the path is correct and try again.
    At line:1 char:1
    + set-adattribute

Leave a Comment