I am writing a PowerShell script for my morning routine. I want to pull only the Warnings and Errors from a list of remote servers. Currently I am only getting either Warnings or Errors. I am not certain how to retrieve both. Once I pull the info, it doesn't include the server. My query is below:
# SERVER LIST PROPERTIES
# Get computer list to check disk space. This is just a plain text file with the servers listed out.
$computers = Get-Content "C:\MorningChecks.txt";
# QUERY COMPUTER SYSTEM EVENT LOG
foreach($computer in $computers)
{
Get-EventLog -LogName System -EntryType Error -After (Get-Date).Adddays(-1) | Format-Table -Wrap ;
}