Jerry Seinfield
asked on
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
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
Get-DistributionGroup -ResultSize Unlimited | ft displayname,alias,primarysmtpaddress,managedby | export-csv C:\temp'test.csv
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
ASKER
Hi Subsun,
I ran your script, but the csv file did not return any information, please see attached file
Any ideas?
report.csv
I ran your script, but the csv file did not return any information, please see attached file
Any ideas?
report.csv
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..
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
ASKER
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
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
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..
Distribution list inconsistent means there could be some issues with the DL alias..
ASKER
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?
Any ideas?
Did you check latest jpg file attached above?
This is what I get when I test the script..
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..
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
ASKER
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?
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?
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?
Are you getting the members when you run the following command?
(Get-DistributionGroupMember testGroup | Select -ExpandProperty Name) -join "`n"
ASKER
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
As I explained earlier, the alias of each DL starts with #
Any other ideas?
Error2.jpg
Enter the group name in quotes..
"#testGroup"
(Get-DistributionGroupMember "#testGroup" | Select -ExpandProperty Name) -join "`n"
ASKER
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
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
Are you sure you are entering the correct alias?
Or if you have multiple domains in forest? Then run
Or if you have multiple domains in forest? Then run
Set-ADServerSettings -ViewEntireForest:$TRUE
(Get-DistributionGroupMember "#testGroup" | Select -ExpandProperty Name) -join "`n"
ASKER
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?
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?
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
no luck, same results as per latest test, only one member is returned
Please see attached file
error4.jpg
Please see attached file
error4.jpg
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
You rock
Changing the line 5 did the trick
Many thanks for all the help
Changing the line 5 did the trick
Many thanks for all the help
Good.. Not sure how the old code was not working for you while both the codes are working for me.. :-)
ASKER
Thanks