Solved

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

Posted on 2013-06-24
4
585 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 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

Announcing the Most Valuable Experts of 2016

MVEs are more concerned with the satisfaction of those they help than with the considerable points they can earn. They are the types of people you feel privileged to call colleagues. Join us in honoring this amazing group of Experts.

Question has a verified solution.

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

How to resolve IMCEAEX NDRs in Exchange or Exchange Online related to invalid X500 addresses.
After hours on line I found a solution which pointed to the inherited Active Directory permissions . You have to give/allow permissions to the "Exchange trusted subsystem" for the user in the Active Directory...
In this video we show how to create a Distribution Group 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 >>…
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…

738 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