none
Set custom AD attributes RRS feed

  • Question

  • Hey,

    I have created a custom user attribute, and I want to change via PS.

    PS does see the attribute when I use get-aduser but when I try to set it, it says "parameter unknown".

    could you please help me.

    best regards.

    Wednesday, March 9, 2016 10:44 PM

Answers

  • The attribute name should not be quoted.

    Sset-ADObject "bac42091-5c4f-489f-9ba5-81503f627295" -Replace @{publishmobile="13334445555"}


    Richard Mueller - MVP Enterprise Mobility (Identity and Access)

    • Marked as answer by kong100 Thursday, March 10, 2016 7:23 AM
    Wednesday, March 9, 2016 11:24 PM
    Moderator

All replies

  • When you use Get-ADUser, specify your custom attribute with the -Properties parameter. Specify the LDAPDisplayName of the attribute. If that doesn't work, try -Properties *.

    With Set-ADUser, use the -Replace parameter to assign a value. See the help for Set-ADUser.


    Richard Mueller - MVP Enterprise Mobility (Identity and Access)

    Wednesday, March 9, 2016 11:02 PM
    Moderator
  • Thanks,

    When I try to run this:

    set-ADObject"bac42091-5c4f-489f-9ba5-81503f627295"-Replace@{"publishmobile"="true"}

    I get:

    set-ADObject : The parameter is incorrect
    At line:1 char:1
    + set-ADObject "bac42091-5c4f-489f-9ba5-81503f627295" -Replace
    @{"publishmobile"=" ...
    + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    ~~~
        + CategoryInfo          : InvalidOperation: (bac42091-5c4f-489f-9ba5-81503
       f627295:ADObject) [Set-ADObject], ADInvalidOperationException
        + FullyQualifiedErrorId : The parameter is incorrect,Microsoft.ActiveDirec
       tory.Management.Commands.SetADObject

    Where am I getting wrong?

    Wednesday, March 9, 2016 11:08 PM
  • The attribute name should not be quoted.

    Sset-ADObject "bac42091-5c4f-489f-9ba5-81503f627295" -Replace @{publishmobile="13334445555"}


    Richard Mueller - MVP Enterprise Mobility (Identity and Access)

    • Marked as answer by kong100 Thursday, March 10, 2016 7:23 AM
    Wednesday, March 9, 2016 11:24 PM
    Moderator
  • Thanks again,

    but getting the same error again:

    set-ADObject : The parameter is incorrect
    At line:1 char:1
    + set-ADObject "bac42091-5c4f-489f-9ba5-81503f627295" -Replace
    @{publishmobile="Fa ...
    + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    ~~~
        + CategoryInfo          : InvalidOperation: (bac42091-5c4f-489f-9ba5-81503
       f627295:ADObject) [Set-ADObject], ADInvalidOperationException
        + FullyQualifiedErrorId : The parameter is incorrect,Microsoft.ActiveDirec
       tory.Management.Commands.SetADObject

    Thursday, March 10, 2016 7:18 AM
  • Hey, got it to work,

    The problem was that the attribute was a boolean, so I had to convert the parameter to boolean...

    Thanks alot!!!

    Thursday, March 10, 2016 7:24 AM