This bit:
vsCode:$SGProps5 = $SG.samaccountname | Select-Object @{Expression={$SG.Name};Label='Group Name'},@{Expression={@(Get-ADGroupMember -Identity $SG |Select -Expand Name) -join ';'};Label='Name'}
-join is just for when you want to combine multiple strings into a single string. In our case we had an array of strings that we wanted to convert to a single string, so only a single value has to be written to the excel cellCode:$SGMembers = (Get-ADGroupMember -Identity $SG |Select -ExpandProperty Name) -join ';'
OK, I understand.
Cheers! I use to have scripts Id have to run seperately and then copy the CSV from one to another to have a complete report.
Now this works, I can merge the scripts together!