Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

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

Posted on 2013-10-29
2
Medium Priority
?
971 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 2000 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

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

High user turnover can cause old/redundant user data to consume valuable space. UserResourceCleanup was developed to address this by automatically deleting user folders when the user account is deleted.
It’s time for spooky stories and consuming way too much sugar, including the many treats we’ve whipped for you in the world of tech. Check it out!
This video shows how to quickly and easily add an email signature for all users on Exchange 2016. The resulting signature is applied on a server level by Exchange Online. The email signature template has been downloaded from: www.mail-signatures…
Exchange organizations may use the Journaling Agent of the Transport Service to archive messages going through Exchange. However, if the Transport Service is integrated with some email content management application (such as an antispam), the admini…

783 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