Solved

Pull missing information from CSV file in Powershell then export

Posted on 2011-09-28
1
587 Views
Last Modified: 2012-08-13
I have a CSV file that has firstname, lastname and need to grab the email address associated using powershell.

CSV = firstname, lastname

Import to Powershell, Find email address based on lastname, export data (firstname, lastname, email)
0
Comment
Question by:rsn-helpdesk
1 Comment
 
LVL 70

Accepted Solution

by:
Chris Dent earned 500 total points
ID: 36814094
What do you have available to search Active Directory? Quest CmdLets? MS AD CmdLets? Nothing at all? :)

If you had Quest's CmdLets it would go like this:
Import-Csv "YourFile.csv" | ForEach-Object {
  Get-QADUser -FirstName $_.firstname -LastName $_.lastname
} | Select-Object FirstName, LastName, Email |
  Export-Csv "YourOutputFile.csv" -NoTypeInformation

Open in new window

Chris
0

Featured Post

Netscaler Common Configuration How To guides

If you use NetScaler you will want to see these guides. The NetScaler How To Guides show administrators how to get NetScaler up and configured by providing instructions for common scenarios and some not so common ones.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This article will help you understand what HashTables are and how to use them in PowerShell.
Windows 10 came with  a lot of built in applications, Some organisations leave them there, some will control them using GPO's. This Article is useful for those who do not want to have any applications in their image (example:me).
Microsoft Active Directory, the widely used IT infrastructure, is known for its high risk of credential theft. The best way to test your Active Directory’s vulnerabilities to pass-the-ticket, pass-the-hash, privilege escalation, and malware attacks …

820 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question