LoginSignup
8
9

More than 5 years have passed since last update.

Windowsサーバのイベントログをリモートから見る

Posted at

沢山あるwindowsサーバで1台ずつコンソールからイベントログを開いてチェックとか面倒臭い。
サーバ側にイベント通知を仕込めれば良いんだけど、色々あってサーバ側は触れない。
そんな時。

こんな感じのpowershellスクリプトを作って、

$SERVERS = "server", "another"
foreach ($SVR in $SERVERS) {
write-host ""
write-host $SVR
get-eventLog -ComputerName $SVR -LogName SYSTEM -Newest 10
}

こんな感じのバッチから呼び出す。

powershell -executionpolicy remotesigned .\hoge.ps1
pause

powershellスクリプトはデフォルトだと実行できないようになってるから、バッチを噛ませて迂回している。
スクリプト実行端末のポリシーが変えられるなら、バッチを噛ませる必要はない。

8
9
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
8
9