i've text file list of distribution groups i'm trying managedby attribute. tried running different commands seems syntax issue ( new powershell) because i'm able retrieve attribute managedby single distribution group. when i'm formatting , exporting result csv file bunch of numbers. i'm on powershell exchange server 2008.
starting flat text file named groups.txt:
employees@company.com executives@company.com
suggested solution:
$grouplist = get-content groups.txt | foreach {get-distributiongroup -identity $_ | select-object primarysmtpaddress, managedby} $grouplist | export-csv -path results.csv -notypeinformation
gives results like:
"primarysmtpaddress","managedby" "employees@company.com","admin" "executives@company.com","admin"
reproducing "bunch of numbers" issue:
$grouplist = get-content groups.txt | foreach {get-distributiongroup -identity $_ | select-object primarysmtpaddress, managedby} export-csv -inputobject $grouplist -path results2.csv -notypeinformation
resulted in:
"count","length","longlength","rank","syncroot","isreadonly","isfixedsize","issynchronized" "2","2","2","1","system.object[]","false","true","false"
environment: exchange 2013, powershell 5.0, windows 10 tech preview 3