Solved

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

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

PRTG Network Monitor: Intuitive Network Monitoring

Network Monitoring is essential to ensure that computer systems and network devices are running. Use PRTG to monitor LANs, servers, websites, applications and devices, bandwidth, virtual environments, remote systems, IoT, and many more. PRTG is easy to set up & use.

Question has a verified solution.

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

This article shows how to deploy dynamic backgrounds to computers depending on the aspect ratio of display
This article runs through the process of deploying a single EXE application selectively to a group of user.
This tutorial will walk an individual through the process of configuring their Windows Server 2012 domain controller to synchronize its time with a trusted, external resource. Use Google, Bing, or other preferred search engine to locate trusted NTP …
This video shows how to use Hyena, from SystemTools Software, to bulk import 100 user accounts from an external text file. View in 1080p for best video quality.

807 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