Exporting member info for a specific distribution group.
Exchange 2007 SP3
I've been tasked with exporting name and smtp address information from specific distribution groups to a .csv. I have a .ps1 file I've been working with, but it's not giving me the output I need. Here's the scripting that I have now -
$members = Get-DistributionGroup -Identity AllDistributers<br/>Get-Recipient $members.RecipientFilter | select Displayname,PrimarySMTPAddress > alldist.csv
What it's returning in the CSV is every contact and mailbox in the entire organization, so it's not filtering it by the group I specified.
Also, within the CSV, the name and address are both in the same cell, so it's not doing that right, either.
Any thoughts?
Thanks,
Noah
June 20th, 2011 7:22pm
On Mon, 20 Jun 2011 13:45:13 +0000, Noah Adams wrote:
>
>
>Exchange 2007 SP3
>
>I've been tasked with exporting name and smtp address information from specific distribution groups to a .csv. I have a .ps1 file I've been working with, but it's not giving me the output I need. Here's the scripting that I have now -
>$members = Get-DistributionGroup -Identity AllDistributers
Get-Recipient $members.RecipientFilter | select Displayname,PrimarySMTPAddress > alldist.csv
>
>
>What it's returning in the CSV is every contact and mailbox in the entire organization, so it's not filtering it by the group I specified.
Distribution groups don't have a recipientfilter property (dynamic
distribution groups do). The result is the same as running
"get-recipient" with no parameters.
Use this:
(get-group dlname).members | foreach {get-recipient $_} | select
displayname,primarysmtpaddress | export-csv c:\temp\xxx.csv
-notypeinfo
>Also, within the CSV, the name and address are both in the same cell, so it's not doing that right, either.
>
>Any thoughts?
If you want a CSV file pipe the output of the "select" into
"export-csv", don't redirect the data to a file.
---
Rich Matheisen
MCSE+I, Exchange MVP
--- Rich Matheisen MCSE+I, Exchange MVP
Free Windows Admin Tool Kit Click here and download it now
June 20th, 2011 10:55pm
Thanks very much - that did the trick!
June 21st, 2011 2:17pm