read email addresses from CSV and get company, department and jobtitle

Welcome Forums General PowerShell Q&A read email addresses from CSV and get company, department and jobtitle

Viewing 7 reply threads
  • Author
    Posts
    • #272752
      Participant
      Topics: 1
      Replies: 4
      Points: 21
      Rank: Member

      Appreciate any help.

      I have been provided with a list of internal email addresses and there’s too many to manually look up the company, department and jobtitle for each one.

      How could I read in list and look up company, department and jobtitle for each one and export the results to a CSV?

      I would have to repeat this every month.

      Thanks

      • This topic was modified 1 week, 5 days ago by Woolly90. Reason: typo
    • #272779
      Participant
      Topics: 5
      Replies: 341
      Points: 585
      Helping Hand
      Rank: Major Contributor

      Show your current code and I will help with your issue.

    • #272785
      Participant
      Topics: 1
      Replies: 4
      Points: 21
      Rank: Member

      Fair comment. I don’t have code at the moment beyond using Get-AzureADUser to do it for one user. Prior to posting I’ve spent several hours googling for an answer or some clue about how to wrap the command in a ForEach loop. I’m not a PowerShell user and from what I read I probably need to use Get-ADUser and work out how to get that cmdlet , because I don’t have it.

    • #272797
      Participant
      Topics: 5
      Replies: 170
      Points: 656
      Helping Hand
      Rank: Major Contributor

      What format is this list?  csv?  Can you provide at least a sample of what you are trying to import.  Redact whatever you need, the actual data is unimportant but the format is needed to help.

    • #272800
      Participant
      Topics: 1
      Replies: 4
      Points: 21
      Rank: Member

      Hi, it is a single column in a CSV.

      Column heading

      [email protected]

      [email protected]

      [email protected]

    • #272803
      Participant
      Topics: 1
      Replies: 4
      Points: 21
      Rank: Member

      Output I’m being asked for is

      email address | Company name | Department | Job Title

      We use the company field for different parts of our org so it varies.

      One of these fields will reveal if the user is one we need to speak to. They will either have a keyword we are interested in, or will work in an area where we know the type of work they do, similarly with job title. It’s essentially a reverse look up because the requests they are making to our service doesn’t capture where in our org they work.

    • #272809
      Participant
      Topics: 5
      Replies: 341
      Points: 585
      Helping Hand
      Rank: Major Contributor

      I don’t have an Azure environment to test this, but try it.

    • #272890
      Participant
      Topics: 1
      Replies: 4
      Points: 21
      Rank: Member

      Holy moly! lightning quick and did exactly what I wanted. You’ve saved me a load of manual handling.

      Thanks!

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