Powershell – How to change AD user description field

In this article we will be using Powershell to perform this. But be aware that we can do this from Active Directory Users and Computers as well.

Let us say that we have a user Ronnie and the description provided for the user is “Ronnie is from the Marketing Team”

You can see the below from the Active Directory Users and Computers.

Powershell - How to change AD user description field

Let us say that you want to change that to “Marketing Department User”

We would use a cmdlet called Set-ADUser to perform this action.

This is actually one of the cmdlets which has the ability to modify the largest number of attributes related to a user account in Active Directory.

Powershell - How to change AD user description field

So the command that will change the description is

Set-ADUser Ronnie -Description “Marketing Department User”

Powershell - How to change AD user description field

Yes it was as simple as that.

Now this doesn’t make sense for a single account to do this from a Powershell window. You are better off using the Active Directory Users and Computers.

But imagine, you as an Administrator receive request to change 500 user descriptions and your manager just sent that in an excel sheet.

That is when Powershell comes into the picture to make your life simple.

Let us say that you modified the excel file that you received and converted to csv file in the below format.

The first column contains the SamAccountName and the second column you can have the updated description that needs to be applied.

So the way you would write the script will be as seen below.

Import-Module ActiveDirectory
$Users = Import-csv c:\Users.csv
foreach($User in $Users){
Set-ADUser $User.SamAccountName -Description $User.NewDescription
}

Save it as a .ps1 file and run from a Powershell window.

Boom! You just updated 500 User accounts details that easily.

I hope that this was informative and thank you for reading!