Update a Value in an Array When Using Match Operator

Hello Everyone,

I have this array:

$hashtable = @{'NAME' = "Name1";
'NODE' = "Node1";

 $node = New-Object -TypeName psobject -Property $hashtable
 $node.psobject.TypeNames.Insert(0,"MyTest")
 $nodess +=  $node
 
# add several nodes (Node2, Node3, etc.) to this array then use -match to find a node

if ($node.Name -match $mynodename)
            {
            $node.NODE = "NewNode"
            }

I’d like to use -match to find and update a record per example above. Is there a good way to do this without doing a “for each” and finding an index?
I get this error when trying to update a value:
The property ‘NODE’ cannot be found on this object. Verify that the property exists and can be set.

Alright, ended up using

 $index = $node.Name.Indexof($mynodename)
$node[$index].NODE = “NewNode”