(特にチェックするサーバが多ければ多いほど)
ということで、作業PCからPowerShellを使用し、
リモートでイベントビューアを表示する方法を調べてみた。
PS> # 共有リソースに接続 PS> net use \\[host-name or ip-address] [password] /user:[user-name] PS> PS> # イベントログを表示 PS> Get-EventLog system -ComputerName [host-name or ip-address] |
過去n日間に発生したシステムエラーの件数を表示したいならこんな感じ
PS> net use \\[host-name or ip-address] [password] /user:[user-name] PS> PS> # ndays はマイナスの値にすること PS> $ndays = -3 PS> $error_count = Get-EventLog system -ComputerName [host-name] | Where-Object { $_.EntryType -eq "Error" -and $_.TimeGenerated -gt (Get-Date).AddDays($ndays) } | Group-Object $_.EntryType |
0 件のコメント:
コメントを投稿