Solved

Powershell script to export SAMaccount name based on input file containing primary SMTP address

Posted on 2013-10-29
2
911 Views
Last Modified: 2013-10-29
Hi All

I have been given a csv file that contains primary SMTP addresses for users on our Exchange 2010 servers.

I need a way to use that csv file as an input and export the samaccountname too.

Thanks
0
Comment
Question by:ncomper
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
2 Comments
 
LVL 40

Accepted Solution

by:
Subsun earned 500 total points
ID: 39608571
Try..
Import-Csv C:\input.csv | Select SMTP,@{N="SamAccountName";e={(Get-Mailbox $_.SMTP).SamAccountName}} | Export-Csv C:\report.csv -NTI

Open in new window

input.csv format..
smtp
subsun@ee.com
ncomper@ee.com

Open in new window

0
 
LVL 5

Author Closing Comment

by:ncomper
ID: 39608772
Excellent, Thanks again
0

Featured Post

Does Powershell have you tied up in knots?

Managing Active Directory does not always have to be complicated.  If you are spending more time trying instead of doing, then it's time to look at something else. For nearly 20 years, AD admins around the world have used one tool for day-to-day AD management: Hyena. Discover why

Question has a verified solution.

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

Check out this step-by-step guide for using the newly updated Experts Exchange mobile app—released on May 30.
Microsoft Office 365 is a subscriptions based service which includes services like Exchange Online and Skype for business Online. These services integrate with Microsoft's online version of Active Directory called Azure Active Directory.
This video discusses moving either the default database or any database to a new volume.
Attackers love to prey on accounts that have privileges. Reducing privileged accounts and protecting privileged accounts therefore is paramount. Users, groups, and service accounts need to be protected to help protect the entire Active Directory …
Suggested Courses

635 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