Forum Discussion

Mats Warnolf's avatar
Mats Warnolf
Brass Contributor
May 03, 2017
Solved

expanding a System.Collections.Generic.List[string]

Im using the following code to add properties to an object   $ten = Get-MsolCompanyInformation -TenantId $tenantItem $objTenantData = New-Object -TypeName system.object $objTenantData | Add-Member ...
  • Peter McDonald's avatar
    May 09, 2017
    I am assuming that the Add-member line is just one of many you want to add to the $objTennantData object and that you want the string array added as a single value (let me know if these assumptions are incorrect)

    If so, for any properties that are arrays use the following:
    $objTenantData | Add-Member -Type NoteProperty -Name AuthorizedServiceInstances -value ($ten.AuthorizedServiceInstances -join ' ')

    Note: You can put other symbols in the ' ' after join and that is what will separate each value in the new string.

Resources