Get DepartmentNumber Attribute from Active Directory RRS feed

  • Question

  • I'm having issues retrieving just the value for the DepartmentNumber attribute in AD. If I enter Get-ADUser $user -Properties DepartmentNumber | select @{Name='DepartmentNumber';Expression={$_.DepartmentNumber}} I can kind of get what I want but it sets a name to the value and I just want the value itself. Does anyone have any suggestions on how I can retrieve just the value of the attribute?

    Eric J

    Wednesday, February 28, 2018 5:58 PM

All replies

  • Get-ADUser $user -Properties DepartmentNumber | select -expand DepartmentNumber

    Script Center

    Learn PowerShell  


    Wednesday, February 28, 2018 6:19 PM
  • Well crap. I must have made a typo the first time I tried that because I swear I tried that and received and error. Thanks for the help.
    Wednesday, February 28, 2018 7:54 PM
  • Hi,

    I'm checking how the issue is going, was your issue resolved?

    And if the replies as above are helpful, we would appreciate you to mark them as answers, and if you resolve it using your own solution, please share your experience and solution here. It will be greatly helpful to others who have the same question.

    Appreciate for your feedback.

    Best Regards,

    Please remember to mark the replies as an answers if they help.
    If you have feedback for TechNet Subscriber Support, contact tnmff@microsoft.com

    Thursday, March 1, 2018 5:54 AM