PowerTip: Using Set-ADUser with multi-valued attributes

Doctor Scripto

Summary: Using the -Replace parameter with Set-ADUser to take an array to populate multi-valued attributes

A picture containing scissors

Description automatically generated

Question: Hey Doctor Scripto, how can I use Set-ADUser to populate multivalued attributes in Active Directory?

Answer: You can use an array with the -Replace parameter to do it.

Set-ADUser -Identity “TestUser” -Replace @{ProxyAddresses = @(“Address1″,”Address2″,”Address3”)}

PowerShell, Doctor Scripto, PowerTip, Active Directory, Walid Moselhy

 

1 comment

Discussion is closed. Login to edit/delete existing comments.

  • Артём Ернекян 0

    Hi Doc, i have the fllowing problem:

    Set-ADUser $User -Replace @{Attribute = @(“value1″,”value2”)}
    Get-ADUser $User -Properties Attribute
    $User.Attribute: {value2, value1}

    how can i fix the position
    p.s. i try change value1 and value2 but the result is the same

Feedback usabilla icon