by Lembasts at 2013-04-02 17:37:51
Greetings,by mjolinor at 2013-04-02 17:52:51
Let’s say I had a ‘Master’ collection that contained a computername property and dozens of other properties.
Then let’s say I had a ‘transaction’ collection that contained a computername property and dozens of other properties.
I want to remove all instances in the ‘Master’ collection where the computername matches one that exists in the ‘transaction’ collection. (For this comparison I dont care about the other properties)
All ‘Master’ collection properties for the remaining instances need to be preserved.
I have tried some nasty coding loops to achieve this but im wondering what would be the most efficient way of coding this?
I’d think this would work:by Lembasts at 2013-04-02 17:56:42$computerlist = $transactions |
select -ExpandProperty computername -Unique
$Newmaster = $master |
where {$computerlist -notcontains $_.computername}
Thanks heaps. I was trying something with notcontains but I couldnt get a straight list of computernames. It was the expandproperty that I needed!!!