Solved

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

Posted on 2013-10-29
2
841 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
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

Windows Server 2016: All you need to know

Learn about Hyper-V features that increase functionality and usability of Microsoft Windows Server 2016. Also, throughout this eBook, you’ll find some basic PowerShell examples that will help you leverage the scripts in your environments!

Join & Write a Comment

This process describes the steps required to Import and Export data from and to .pst files using Exchange 2010. We can use these steps to export data from a user to a .pst file, import data back to the same or a different user, or even import data t…
Scam emails are a huge burden for many businesses. Spotting one is not always easy. Follow our tips to identify if an email you receive is a scam.
how to add IIS SMTP to handle application/Scanner relays into office 365.
This video discusses moving either the default database or any database to a new volume.

707 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

Need Help in Real-Time?

Connect with top rated Experts

20 Experts available now in Live!

Get 1:1 Help Now