Powershell – How to change AD user description field

1

Hello All,

Its been some time that I wrote an article, but today we will seeing how to change AD user description field in Active Directory.

Of course 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.

Powershell - How to change AD user description field

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!

Share.

About Author

I am Adil Arif, working as a Senior Technical Support Engineer at Rubrik as well as an independent blogger and founder of Enterprise Daddy. In my current role, I am supporting infrastructure related to Windows and VMware datacenters.

1 Comment

Leave A Reply

LIKE WHAT YOU'VE READ?
If so, please join the community.  I’d love to send you exclusive content right to your email, and I’ll send you a free copy of my book, VMware vSphere 6.0 Lab on Workstation too!
Enter your name and email below, and I’ll see you on the inside!

SUBSCRIBE