AD: How To Populate extensionAttribute using PowerShell?

Updating attributes on a user object or computer object in your Active Directory can be done very easily. Thanks to Windows PowerShell and the Set-ADUser cmdlet, it is possible to populate a value and/or clear a value. Let’s see how to perform this task.

In the example below, I will add a value to the “extensionAttribute15” attribute:

PS > Set-ADUser -Identity $user -Add @{extensionAttribute15 = "Welcome"}

You can also use the Set-ADComputer cmdlet in order to update a value on a computer obkect.

Now, if you need to remove a value, you must replace -Add with -Clear parameter:

PS > Set-ADUser –Identity $user -Clear "extensionAttribute15"

Please note that if a value already exists in the attribute, then you must clear the value before adding a new one.

Thanks for reading! You can follow me on Twitter @PrigentNico

About Nicolas 282 Articles
I work as an IT Production Manager, based in Paris (France) with a primary focus on Microsoft technologies. I have 10 years experience in administering Windows Servers. . I am a Microsoft MVP for Cloud & Datacenter Management. I also received the PowerShell Hero 2016 award by PowerShell.0rg. And finally, I am "MCSE: Cloud Platform and Infrastructure", "MCSA: Windows Servers", "Administering & Deploying SCCM", and CheckPoint CCSA certified.