this post is supplementary to this thread here
Basically, I have 2 scripts
script1 has the following:
$exportObject = New-Object System.Collections.ArrayList
$exportObject | Select-Object
in script2, i am calling script1 to do something and piping the output to an -ov
& "script1.ps1" -ov $outputValue
$outputValue
this is what i get
i would like to covert $outValue to pscustomobject dynamically, because Theo's answer (in link above) requires pscustomobject, and my $outValue is an array list/select object...
basically the pscustomobject would hold values like this, but this is not dynamic and instead hardcoding the keys/values.
$outValue = @(
[PSCustomObject]@{
'Server' = 'Server1.com'
'Cube' = 'Cube1'
'Connection Details' = 'Connection changed!'
}
)
i am looking for something like this:
$outValue = $outValue | foreach-object () { @(
[PSCustomObject]@{
$key = $value
}
}
)
