PoshTip #54 – Change AD computers attributes with PowerShell

PowerShell can help you to easily update some attributes on a computer or user Active Directory object. Basically it means that if you need to change a custom attribute value to a new one then you must use the Set-ADComputer cmdlet. Let’s see how to use this cmdlet.

First, you must check the Active Directory Name of the attribute that need to be updated (telephonenumber, location, cn, …)

Next, the syntax is the following using the -Add parameter:

Set-ADComputer -Identity "<Your_Hostname>" -Add @{"<attribute_name>"="<value>"}

Please note that you can use the -credential parameter if needed.

Finally, let’s imagine that I want to update “extententionattribute1”:

Set-ADComputer -Identity "SRV01" -Add @{"extensionattribute1"="17022017"}

It’s done!


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.