I\'m going through an array of objects and I can display the objects fine.
$obj
displays each object in my foreach loop fine. I\'m trying t
You don't have to iterate over all properties if you just need the value of one of them:
$obj.psobject.properties["bla"].value
Operator precedence interprets that in the following way:
($obj.$_).Name
which leads to nothing because you want
$obj.($_.Name)
which will first evaluate the name of a property and then access it on $obj
.
Once you iterate over the properties inside the foreach, they become available via $_
(current object symbol). Just like you printed the names of the properties with $_.Name
, using $_.Value
will print their values:
$obj.psobject.properties | % {$_.Value}