Difference between AD mobile and mobilephone property

This topic contains 2 replies, has 2 voices, and was last updated by Profile photo of Yuan Li Yuan Li 1 year, 3 months ago.

  • Author
  • #36557
    Profile photo of Yuan Li
    Yuan Li

    Hey Guys,

    I meet a strange issue, not sure if it's a bug or feature. I want to update someone's mobile number in AD like that

    get-aduser -identity $user -Properties name,mobile | Set-ADUser -Replace @{mobile=$num}

    It's working, but when I use mobilephone instead of mobile, I got an error message

    set-aduser : The specified directory service attribute or value does not exist

    if I just run get-aduser and get-member, both properties return the same result but why I can't use mobilephone in the set-aduser comlet?


  • #36559
    Profile photo of Dave Wyatt
    Dave Wyatt

    The AD cmdlets try to be "helpful" by creating some friendlier names for properties than the underlying LDAP names. "mobile" is an LDAP property name; MobilePhone is what the AD module wraps in the objects. When you're using the -Replace parameter, you're working with generic LDAP property names.

    If you want to use the friendlier names, do this instead:

    Get-ADUser -identity $user -Properties name,mobile | Set-ADUser -MobilePhone $num

    Incidentally, you could also just do this instead of using a pipeline:

    Set-ADUser -Identity $user -MobilePhone $num
  • #36588
    Profile photo of Yuan Li
    Yuan Li

    Thanks Dave!

    I checked the help of set-ADuser and in the syntax it only include mobilephone property.


You must be logged in to reply to this topic.