So I have an issue with my foreach loop, and I cant figure out what I am doing wrong.
The following is an example of my code:
$objectarray ##( So this variable contains a list of lists ie name + address) ##
Foreach ($object in $objectarray.name){
$objectid = $objectarray.Where({$_.name -eq "$object"}).id
$objectaddress = $objectarray.Where({$_.name -eq "$object"}).address
$objectprint = "$objectid" + ": " + "$objectaddress"
$objectprint
return 0
}
Now the problem is $objectarray has multiple lists inside it each with its name, id, address etc
But it ONLY prints the FIRST one, and I get ONLY the first 0 as return...despite the fact there are many of them