[Last Call] Learn about multicloud storage options and how to improve your company's cloud strategy. Register Now

x
?
Solved

Exchange PowerShell:  List SMTP E-Mail address from a Distribution List in a defined format

Posted on 2013-06-24
4
Medium Priority
?
591 Views
Last Modified: 2013-06-24
I need to extract following information from a Distribution List:

 - Primary SMTP Address of ManagedBy object
 - All SMTP addresses of all members of the distribution list


then I need to have the following format of the output

--------------------------------------------------------output.txt--------------------------------------------------------
SMTPAddress1Member1 PrimarySMTPAddressOfManagedByObject
SMTPAddress2Member1 PrimarySMTPAddressOfManagedByObject
SMTPAddress3Member1 PrimarySMTPAddressOfManagedByObject
SMTPAddress1Member2 PrimarySMTPAddressOfManagedByObject
SMTPAddress2Member2 PrimarySMTPAddressOfManagedByObject
--------------------------------------------------------output.txt--------------------------------------------------------

Example output.txt file:

Mark.Henderson@gmail.com JunkAdmin1@gmail.com
M.Henderson@gmail.com JunkAdmin1@gmail.com
Mark.H@gmail.com JunkAdmin1@gmail.com
Lisa.Simpson@gmail.com  JunkAdmin1@gmail.com
L.Simpson@gmail.com  JunkAdmin1@gmail.com
Lisa.S@gmail.com  JunkAdmin1@gmail.com
Michael.Kight@gmail.com  JunkAdmin1@gmail.com
M.Kight@gmail.com  JunkAdmin1@gmail.com
Michael.K@gmail.com  JunkAdmin1@gmail.com

Open in new window



I know this sounds very tricky, but maybe someone coded this one already :-)

Thanks for any help!
0
Comment
Question by:whenz
[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
  • 2
4 Comments
 
LVL 40

Expert Comment

by:Subsun
ID: 39272670
By PrimarySMTPAddressOfManagedByObject, do you mean the PrimarySMTPAddress of the group?
0
 

Author Comment

by:whenz
ID: 39272690
No, I mean the primary SMTP Address of the ManagedBy Attribute.  Please see the attached example, I would need the primary SMTP address of user "povici"
EE-screenshot.jpg
0
 
LVL 40

Accepted Solution

by:
Subsun earned 2000 total points
ID: 39272736
Try..
$Group = "Group Name"
$ManagedBy = (Get-Mailbox (Get-DistributionGroup "Group Name").ManagedBy).PrimarySmtpAddress.ToString()

Get-DistributionGroupMember $Group | % {

Add-Content C:\Group.txt "$($_.PrimarySmtpAddress.ToString()) $ManagedBy"

}

Open in new window

0
 

Author Closing Comment

by:whenz
ID: 39272824
Subsun you're a wizard, thank you indeed!!!
0

Featured Post

Are your AD admin tools letting you down?

Managing Active Directory can get complicated.  Often, the native tools for managing AD are just not up to the task.  The largest Active Directory installations in the world have relied on one tool to manage their day-to-day administration tasks: Hyena. Start your trial today.

Question has a verified solution.

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

How to deal with a specific error when using the Enable-RemoteMailbox cmdlet to create a mailbox in the cloud-based service, for an existing user in an on-premises Active Directory.
The core idea of this article is to make you acquainted with the best way in which you can export Exchange mailbox to PST format.
In this video we show how to create a Contact in Exchange 2013. We show this process by using the Exchange Admin Center. Log into Exchange Admin Center.: First we need to log into the Exchange Admin Center. Navigate to the Recipients >> Contact ta…
how to add IIS SMTP to handle application/Scanner relays into office 365.

650 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