PowerTip: Set Custom Attributes in Active Directory

PowerTip: Set Custom Attributes in Active Directory

  • Comments 15
  • Likes

Summary: Use the Set-ADUser cmdet to modify custom attributes.

Hey, Scripting Guy! Question How can I use Windows PowerShell to modify a custom attribute in Active Directory?

Hey, Scripting Guy! Answer Use the Set-ADUser cmdlet and it’s –add-replace, and –remove parameters to adjust custom attributes.

For example, to update the Info attribute in Active Directory and replace it with a new value:

SET-ADUSER john.smith –replace @{info=”John Smith is a Temporary Contractor”}

Your comment has been posted.   Close
Thank you, your comment requires moderation so it may take a while to appear.   Close
Leave a Comment
  • Helpful for IDM (Identity Management Team)

  • Excellent, very helpful!

  • Thanks alot!

  • Awesome I needed this thank you!

  • How can I add attribute to the Active Directory schema? if we take example new attribute called "Home Phone Number" how can I add this thing using powershell cmdlets.
    Thank You.

  • It was a great help. I was searching for something like this, just edited. Thank you!

  • I am getting an exception when I try to perform this command within a For loop or If statement. Everything seems to break with the existence of -replace. Even if I double quote the whole line, "Set-AdUser $USamaccountName –replace @{ManagerEmployeeId=$MEmpID}", everything breaks. Only when I remove the line or comment out the line will the script run.

  • Nevermind I got it. Ye olde hyphen/dash problem. I retyped the line and it worked.

  • Very useful. Thank you so much :)

  • Excellent. Thank you so much for this info.