Get all users under Managed By in AD Group

Hi,

In Exchange 2010 distribution group, Group Information, Managed by, we can added multiple name in it. We would like to create a power shell to get a list of these users. Please advise how to do it. Thanks!
prashant06Asked:
Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

x
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.

Marwan OsmanCommented:
Get-DistributionGroup -ResultSize unlimited | Select-object Name,@{label=”ManagedBy”;expression={[string]($_.managedby | foreach {$_.tostring().split(“/”)[-1]})}},Primarysmtpaddress | export-csv “c:\managedby.csv”
Marwan OsmanCommented:
I just tried it on my exchange 2013 and it works perfectly
Marwan OsmanCommented:
see the script, it is ended with  export-csv “c:\managedby.csv”, so in C:\ you will get a CSV named managedby contains the result
Determine the Perfect Price for Your IT Services

Do you wonder if your IT business is truly profitable or if you should raise your prices? Learn how to calculate your overhead burden with our free interactive tool and use it to determine the right price for your IT services. Download your free eBook now!

Marwan OsmanCommented:
{Can it filter out those records where MangedBy is empty}

it is another question and must be asked separately in a new question...
prashant06Author Commented:
The managed by will have multiple user name. How to put in a separator, such as ;, between them?
Marwan OsmanCommented:
run the script, it will arrange it in the same cell with comma
prashant06Author Commented:
I already run the script but there is no comma in the ManagedBy field.
Marwan OsmanCommented:
you are right, also I just run it and there is no comma, but it will list all the users who managed the group but without comma
prashant06Author Commented:
can it be done? Since I want to generate a report to show who manage which group.
Marwan OsmanCommented:
does it not helpful unless there is a comma between names?
Marwan OsmanCommented:
the idea is to list all users who managed the groups regardless the comma, I am trying to find it out and include comma
Marwan OsmanCommented:
use the below script, it will list it in different way:

Get-DistributionGroup -ResultSize Unlimited | select Displayname -ExpandProperty Managedby | Select Displayname, name | Export-CSV c:\groups.csv

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
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.