Export-CSV Issue Maybe

Trying to use Export-CSV and the output includes the return type instead of the value.

 Get-CsVoiceRoute | select-object Name,Identity,PstnGatewayList,Description,Priority,NumberPattern,PstnUsages,SuppressCallerId,AlternateCallerId |export-csv $env:UserProfile\Desktop\VoiceRoute.csv 

The “PstnGatewayList” value is replaced by the item type during the export. Hoping there is a work around.

Found that the item I am trying to return is a collection, now to get that collection to output.

PS. this is a Lync cmdlet
PSS. I’m a PS novice.

Boe Prox has a good article on how to deal with this: learn-powershell.net.

Your select will need to be
select-object Name,Identity,@{l=‘PstnGatewayList’;e={$_.PstnGatewayList -join ‘,’}},Description,Priority,NumberPattern,PstnUsages,SuppressCallerId,AlternateCallerId

Change the -Path for your Export-CSV

$(join-path -path $env:UserProfile -ChildPath \Desktop\VoiceRoute.csv)

Thank you guys.

 select-object Name,Identity,@{l='PstnGatewayList';e={$_.PstnGatewayList -join ','}},Description,Priority,NumberPattern,PstnUsages,SuppressCallerId,AlternateCallerID 

I modified this one and it works great expect for one. When I use the cmdlet get-cstopology, and I use

@{Name='InternalDomains';Expression={[string]::join(“;”, ($_.InternalDomains))}}
it fails to return the values.

Syntax looks OK. Are you sure InternalDomains isn’t an empty collection?

I am sure, it has two results, however the output returns the object class (if I am saying that right) rather than the results. The difference seems to be the export. If I comment out the export I get the result.

I wonder if you have a problem with nested collections. I.e. the objects in the InternalDomains collection are themselves collections and/or those collections also have nested collections.

Try piping to Get-Member to investigate.

I think your best bet is going to be to create a custom object with all the properties you’re after and then export your custom object to the CSV file.