I'm building a script to monitor my event logs. This command gathers only "Error" and "Warning" messages and places them into the $entries array.
$entries = $log.Entries | ? {$_.TimeWritten -gt ($(Get-Date).AddDays(-2)) -and ` (($_.EntryType -like "Error") -or ` ($_.EntryType -like "Warning"))} | Format-Table -wrap
If I output $entries in the console, it displays what I want - the log entries - but if I pipe this out to a text file (Add-Content $output $entries) I get the .NET class name only (System.Diagnostics.EventLogEntry). I have also tried foreach ($entry in $entries) with similar results.
What's the basic PowerShell principle I'm missing here?