Get Organizational Unit of a sAMAccountName

Welcome Forums General PowerShell Q&A Get Organizational Unit of a sAMAccountName

This topic contains 2 replies, has 2 voices, and was last updated by

 
Participant
1 year, 2 months ago.

  • Author
    Posts
  • #80578

    Participant
    Points: 0
    Rank: Member

    Hello!
    Is there a way to get a place (OU) where a particular sAMAccountName is held?
    E.x. I have n.karetnikov in a domain with 100k users. I do not know which Organization Unit this userID is stored. The result of the script would be smth like "OU=users,OU=moscow_site,DC=mycompany,DC=RU"
    Is that possible at all? 🙂

  • #80581
    Jon

    Participant
    Points: 37
    Rank: Member

    get-aduser n.karetnikov | select distinguishedname

    • #80584

      Participant
      Points: 0
      Rank: Member

      so simple! 🙂
      Thank you!!!

The topic ‘Get Organizational Unit of a sAMAccountName’ is closed to new replies.