Expanding System.Object for export to csv

I have a script that runs through a list of distribution groups and extracts the members and exports to a csv file.

It works well except where there is more than one member in the group. The output on the screen shows all the members in the Members Column but the csv file shows system.object .

I have tried using the output-string.trim() with limited success. This does remove the system.object but it only returns the first member in the list if there are more than one.

Scenario #1 - No overloads

On the console it looks like this:

Scenario #2 using Output-string.Trim()

Can you look at the script below and tell me what I need to change to capture all the members so they are correctly exported to the csv?

$forwards = get-distributiongroup -filter {name -like “*forwarder”} | select-object name

$forwarders = foreach($group in $forwards)

{
    [pscustomobject]@{
   
        group = $group.name
        members = (get-distributiongroupmember $group.name | select-object name -ExpandProperty name | out-string).trim()
   
           
    }
   

}

$forwarders | export-csv c:\scripts\csvfiles\mail\forwarders.csv

Use a join to put all members into one string.

(Get-ADGroupMember ‘domain admins’).name -join '; ’

Thanks Dan. That worked perfectly.