Script to pull sAMAccountName from display names

Welcome Forums General PowerShell Q&A Script to pull sAMAccountName from display names

Viewing 4 reply threads
  • Author
    Posts
    • #257069
      Participant
      Topics: 3
      Replies: 1
      Points: 40
      Rank: Member

      Hey All,

      What’s the best way to pull list of sAMAccountNames from a AD domain email format like [email protected]

       

      I have a bunch of users in a user provided .CSV that I need to find out the sAMAccountNames.

       

      Thanks

      • This topic was modified 2 months, 2 weeks ago by BMW_N5261. Reason: typo
    • #257075
      Participant
      Topics: 9
      Replies: 678
      Points: 2,683
      Helping Hand
      Rank: Community Hero

      Does that consistently match either userprincipalname or mail?

    • #257087
      Participant
      Topics: 3
      Replies: 1
      Points: 40
      Rank: Member

      There’s a UPN column which has the email listed like a above.

    • #257090
      Participant
      Topics: 9
      Replies: 678
      Points: 2,683
      Helping Hand
      Rank: Community Hero

      Assuming the column name in your CSV is email, this is one way.

    • #257291
      Participant
      Topics: 6
      Replies: 3
      Points: 85
      Rank: Member

      I had the same question i the past, where I got help for this too 🙂
      For me this works very well.

      I use it in a for each loop:

       

Viewing 4 reply threads
  • You must be logged in to reply to this topic.