【发布时间】:2014-08-14 03:01:27
【问题描述】:
我正在为早上的例行程序编写一个 PowerShell 脚本。我只想从远程服务器列表中提取警告和错误。目前我只收到警告或错误。我不确定如何检索两者。一旦我提取信息,它不包括服务器。我的查询如下:
# 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 ;
}
【问题讨论】:
标签: powershell