- If the CSV file is completely empty, the Import-CSV returns a $null. The "count" property should return a zero.
- If the CSV file contains only a header row, the Import-CSV returns a $null. The "count" property should return a zero
- If the CSV file contains a header row and one data row, the Import-CSV returns an object of type PSCustomObject. The "count" property should return nothing because that object type contains no "count" property and neither does its parent which is a System.Object.
- If the CSV file contains one header row and two data rows, the Import-CSV returns an object of type Object[] (i.e., an array of objects). The "count" property will have a value of two.
If your code depends on an object always having a "count" property then cast the variable to an appropriate type. E.g., [array]$temp