lol definitely its not broken… sometimes you will have PSCUSTOMOBJECT like the below
Cluster = $API.ClusterName
Agent = @($API.AgentNames -join ' `n `r' )
Status = @($API.Statuses -join ' `n `r' )
when you export-csv $var without -join it will create system.object in the csv output . Hence that is required to avoid it. I cannot avoid using array since some of the cluster contains 1 agent, some may contain more than 1. Thanks to the blog below.
So like you said, if I have to export it the way you want, then I need to modify if Count gt 1 , iterate the array and add member property etc etc…
But I am thinking if i am able to use -join to put it into csv, there should be a way to reverse it as well.
However, Yes, the data coming from API results, is itself mix of single values and arrays which cannot be similar to a table considering Database concepts.
Thanks for your responses. I will still keep exploring my options. There shouldn’t be anything that PowerShell cannot do. haha… jk.
I cannot post the full code since I cannot access this blog from office network , neither I can email outside the network.