I am trying to filter data from a CSV file. There are 3 Columns OS1, OS2, and OS3. If any these 3 cells are anything but yes I need that row exported to another CSV file. Here is what I came up with:
$OSCOL = Import-csv $pwd\$Source\Win.csv | `
where {$_."OS1" -inotmatch "Yes" `
-and $_."OS2" -inotmatch "Yes" `
-and $_."OS3" -inotmatch "Yes" } `
| Export-Csv $pwd\ossla.csv -notypeinfo
However this is not working as expected... If 'any' of the cells are not 'Yes' then that row is not exported. So for example if my csv File is:
servername,OS1,OS2,OS3
serv1,yes,no,no
serv2,yes,Yes,yes
serv3,pending,yes,yes
serv4,no,pending,no
I would want the output of:
servername,OS1,OS2,OS3
serv1,yes,no,no
serv3,pending,yes,yes
serv4,no,pending,no
However I what I am getting is:
servername,OS1,OS2,OS3
Serv4,no,pending,no
What am I doing wrong here?