I have written a script to scan an excel spreadsheet and return a count of specific values and output that count.
The script works fine if there is more than 1 of the same value and returns the count. If the excel spreadsheet only contains 1 value I am looking for count returns as blank.
This is the script I am running
$Skipped = Import-excel -path 'C:\temp\IM April Test Migration Stuff\Sharegate Task Reports\im3.xlsx' | where 'Status' -eq 'Skipped' | select title, Type, status
$report = New-Object psobject
$report | Add-Member -MemberType NoteProperty -Name Skipped -Value $Skipped.count
write-host $report
Any ideas on how to workaround this issue?