I am working my way through a few PowerShell courses but clearly still need assistance. When I run the minor script below it works as it should by displaying which computers in the OU are down. No issue with that but Export-CSV is coming up with no data at all. I have read the help for Export-CSV and didn't see (or missed it) showing any issues with using % when exporting to CSV. Any help along with an explanation would be helpful.
get-adcomputer -Filter -SearchBase "OU=MedDispenseInterface,OU=MedDispense,OU=Computer Accounts,DC=select,DC=corp,DC=sem" -Properties | Select Name, LastLogondate | foreach { if (test-connection $ -quiet) { $Null } else {write-host "$ is down" -foregroundcolor RED}} | Export-Csv -LiteralPath C:\Users\lamsthomas\Desktop\MD.csv