troubleshooting Question

powershell select multiple fields using -expandproperty and arrange in columns exchange 2010

Avatar of techdrive
techdriveFlag for United States of America asked on
ExchangeActive DirectoryPowershell
4 Comments2 Solutions3614 ViewsLast Modified:
Good Evening I need some assistance please. I am using the following command below

get-distributiongroup -identity "groupname" | select managedby -expandproperty | select name

Now this command is great as it gives me just the name without the long path. I was trying to pull another value like the name of the group in a foreach like

This fails when trying to pull multiple fields
get-content c:\nameofdlgroups.csv | foreach { get-distributiongroup -identity $_ } | select managedby -expandproperty , displayname| select name, displayname

My end goal is to get the output to display like this below in a csv file. Its just hard displaying the name of the group plus the multiple owners of the group.

group name
groupmanagedbymember23
groupmanagedbymember13
groupmanagedbymember73
groupmanagedbymember012

group name1
groupmanagedbymember23
groupmanagedbymember13
groupmanagedbymember73
groupmanagedbymember012

group name2
groupmanagedbymember23
groupmanagedbymember13
groupmanagedbymember73
groupmanagedbymember012

group name3
groupmanagedbymember23
groupmanagedbymember13
groupmanagedbymember73
groupmanagedbymember012
ASKER CERTIFIED SOLUTION
Pavel Nagaev
Lead email system administrator

Our community of experts have been thoroughly vetted for their expertise and industry experience.

Join our community to see this answer!
Unlock 2 Answers and 4 Comments.
Start Free Trial
Learn from the best

Network and collaborate with thousands of CTOs, CISOs, and IT Pros rooting for you and your success.

Andrew Hancock - VMware vExpert
See if this solution works for you by signing up for a 7 day free trial.
Unlock 2 Answers and 4 Comments.
Try for 7 days

”The time we save is the biggest benefit of E-E to our team. What could take multiple guys 2 hours or more each to find is accessed in around 15 minutes on Experts Exchange.

-Mike Kapnisakis, Warner Bros