Global DL report

Hello Experts,

Can anyone please provide me with a power Shell cmdlet or script to get the list of all the DLs, the owner and members in Exchange 2010?

Any ideas would be really appreciated
Jerry SeinfieldAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Jerry SeinfieldAuthor Commented:
I need that information exported a CSV file, or spreadsheet

Thanks
0
Muralidharan RAssociate ConsultantCommented:
Get-DistributionGroup -ResultSize Unlimited | ft displayname,alias,primarysmtpaddress,managedby | export-csv C:\temp'test.csv

Open in new window

0
SubsunCommented:
I am not sure what report format you require.. try this code and see if it works for you..
Get-DistributionGroup -ResultSize Unlimited | Select Name,`
	@{N="Owners";E={($_.ManagedBy | %{($_ -split "/")[-1]}) -join "`n"}},`
	@{N="Members";E={($_ | Get-DistributionGroupMember | Select -ExpandProperty Name) -join "`n"}} |
Export-Csv C:\report.csv -NTI

Open in new window

0
The Ultimate Tool Kit for Technolgy Solution Provi

Broken down into practical pointers and step-by-step instructions, the IT Service Excellence Tool Kit delivers expert advice for technology solution providers. Get your free copy for valuable how-to assets including sample agreements, checklists, flowcharts, and more!

Jerry SeinfieldAuthor Commented:
Hi Subsun,

I ran your script, but the csv file did not return any information, please see attached file

Any ideas?
report.csv
0
SubsunCommented:
If your test group has members and ManagedBy properties then the possible reason would be the known pipeline bug for EMS..
I have modified the code a bit.. try it and see if you get the desired result..
$(Foreach ($Group in Get-DistributionGroup -ResultSize Unlimited) {
$Group | Select Name,`
	@{N="Owners";E={($_.ManagedBy | %{($_ -split "/")[-1]}) -join "`n"}},`
	@{N="Members";E={($_ | Get-DistributionGroupMember | Select -ExpandProperty Name) -join "`n"}}
})| Export-Csv C:\report.csv -NTI

Open in new window

0
Jerry SeinfieldAuthor Commented:
Hi Subsun,

The script above did the trick, however it only returned one member and not the multiple members of each DL.

In addition to that, please see error in the attached file below
GlobalDLReportError.jpg
0
SubsunCommented:
It should be.. just expand the row height in excel and see..

Distribution list inconsistent means there could be some issues with the DL alias..
0
Jerry SeinfieldAuthor Commented:
I did expand the row height in excel same results, only one member of each DL is showed

Any ideas?

Did you check latest jpg file attached above?
0
SubsunCommented:
This is what I get when I test the script..
Result
Regarding the warnings.. :

As I said Distribution list inconsistent means there could be some issues with the DL alias.. You need to check if there any illegal characters or trailing space in the DL alias..

Try this code to get rid of the result size limit warning..
$(Foreach ($Group in Get-DistributionGroup -ResultSize Unlimited) {
$Group | Select Name,`
	@{N="Owners";E={($_.ManagedBy | %{($_ -split "/")[-1]}) -join "`n"}},`
	@{N="Members";E={($_ | Get-DistributionGroupMember -ResultSize Unlimited | Select -ExpandProperty Name) -join "`n"}}
})| Export-Csv C:\report.csv -NTI

Open in new window

0
Jerry SeinfieldAuthor Commented:
Hi Subsun

I tried your script above, and got same results [only one member is displayed]

btw, The Alias for all DLs start with the #. This was a client decision, therefore I cannot change the alias for 1500 Dls

Any other ideas in why is not returning all member of each DLs on column C?
0
SubsunCommented:
Sorry I am not able to recreate the issue.. as shown in previous post I am able to see all members in report..

Are you getting the members when you run the following command?
(Get-DistributionGroupMember testGroup | Select -ExpandProperty Name) -join "`n"

Open in new window

0
Jerry SeinfieldAuthor Commented:
I am unable to run the cmdlet above either from EMS or Windows powershell modules. Please see attached file

As I explained earlier, the alias of each DL starts with #

Any other ideas?
Error2.jpg
0
SubsunCommented:
Enter the group name in quotes..
"#testGroup"


(Get-DistributionGroupMember "#testGroup" | Select -ExpandProperty Name) -join "`n"
                                            

Open in new window

0
Jerry SeinfieldAuthor Commented:
Thanks Subsun,

Still unable to run the command. 1st intent, is unable to locate a domain controller on the domain, second one found an error. Please see attached jpg file
Error3.jpg
0
SubsunCommented:
Are you sure you are entering the correct alias?

Or if you have multiple domains in forest? Then run

Set-ADServerSettings -ViewEntireForest:$TRUE
(Get-DistributionGroupMember "#testGroup" | Select -ExpandProperty Name) -join "`n"

Open in new window

0
Jerry SeinfieldAuthor Commented:
Ok,

I was able to see all members of one DL by using the 2 commands above, so, What could be wrong with the script that is only returning oe member?
0
SubsunCommented:
Try..
Set-ADServerSettings -ViewEntireForest:$TRUE
$(Foreach ($Group in Get-DistributionGroup -ResultSize Unlimited) {
$Group | Select Name,`
	@{N="Owners";E={($_.ManagedBy | %{($_ -split "/")[-1]}) -join "`n"}},`
	@{N="Members";E={($_ | Get-DistributionGroupMember -ResultSize Unlimited | Select -ExpandProperty Name) -join "`n"}}
})| Export-Csv C:\report.csv -NTI

Open in new window

0
Jerry SeinfieldAuthor Commented:
no luck, same results as per latest test, only one member is returned

Please see attached file
error4.jpg
0
SubsunCommented:
That's strange.. What if you change line 5 to
	@{N="Members";E={($_ | Get-DistributionGroupMember -ResultSize Unlimited | Select -ExpandProperty Name) -join ","}}

Open in new window

0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
Jerry SeinfieldAuthor Commented:
You rock

Changing the line 5 did the trick

Many thanks for all the help
0
SubsunCommented:
Good.. Not sure how the old code was not working for you while both the codes are working for me.. :-)
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Powershell

From novice to tech pro — start learning today.