This is my $array:
Name GUID
---- ----
PC001 AAAA
PC001 BBBB
PC001 CCCC
PC002 AAAA
PC002 DDDD
PC003 AAAA
PC003 CCCC
Here's my script:
$Guid = "CCCC"
$workingName = $array | where Guid -eq $Guid | select name
$array.remove($workingName) #broke!
What I'm trying to achieve is that if $Guid = "CCCC" it would remove all instances of the Name and CCCC from the array, where CCCC exists, so in this instance five lines (three lines for PC001, two lines for PC0003), if it was BBBB it would only remove the three lines for PC001.
FYI: this is part of a much larger script