Solved

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

Posted on 2013-06-24
4
577 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
  • 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 500 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

How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

Join & Write a Comment

Utilizing an array to gracefully append to a list of EmailAddresses
Local Continuous Replication is a cost effective and quick way of backing up Exchange server data. The following article describes the steps required to configure Local Continuous Replication. Also, the article tells you how to restore from a backup…
To show how to create a transport rule 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 Mail Flow >> Rules tab.:  To cr…
This video discusses moving either the default database or any database to a new volume.

708 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

17 Experts available now in Live!

Get 1:1 Help Now