Quantcast
Channel: The Official Scripting Guys Forum! forum
Viewing all articles
Browse latest Browse all 15028

Import-CSV does not always provide the "Where" method

$
0
0

I'm trying to do something simple - sorry for the sloppiness:

$arr1 = Import-Csv c:\arr1.csv

$arr2 = Import-Csv c:\arr2.csv

ForEach($record in $arr1){

      $test = $arr2.Where({$PSItem.User -eq $record.User}).Value

}

But when I do this, I get a method invocation failed because [System.Management.Automation.PSCustomObject] does not contain a method named 'where'.

However, it worked once and if I do $randomcsv = Import-Csv c:\random.csv and then type in $randomcsv, the Where method is available.

Is there a reason why sometimes this works and sometimes it doesn't? It's very strange to me.

Thanks in advance!

WB



Viewing all articles
Browse latest Browse all 15028

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>