-1
wevtutilコマンドを使用して、Windowsサーバのイベントログをテキストファイルにインポート/読み込みしようとしていますか。wevtutilクエリを1行に出力する
$
wevtutil qe Application \rd:true \f:text
(アプリケーションログを読み取り) を、私のコマンドの出力例を、次のとおりです:私はfile.txtに私のログを書き込むには、次のコマンドを使用し
Event[1]:
Log Name: Application
Source: Microsoft-Windows-Security-SPP
Date: 2016-03-29T13:02:27.000
Event ID: 8196
Task: N/A
Level: Information
Opcode: N/A
Keyword: Classic
User: N/A
User Name: N/A
Computer: WIN-IONOGQTF9O5
Description: License Activation Scheduler (sppuinotify.dll)
Event[2]:
Log Name: Application
Source: Microsoft-Windows
Date: 2016-06-29T13:02:57.000
Event ID: 3444
Task: N/A
Level: Critical
Opcode: N/A
Keyword: Classic
User: N/A
User Name: N/A
Computer: WIN-IONOGDFFF9O5
Description: AIRO.Activation code(sppuinotify.dll)
(実際には、2つのサンプルログ)。 しかし、上記の単一行の複数行出力ではなく、.txtファイルに1行としてログを書きたいと思っています。 wevtutil commandユーティリティは以下のように、単一の行にログを書き込むことがあります:
Event[1]:Log Name: Application Source: Microsoft-Windows-Security-SPP Date: 2016-03-29T13:02:27.000 Event ID: 8196 Task: N/A Level: Information Opcode: N/A Keyword: Classic User: N/A User Name: N/A Computer: WIN-IONOGQTF9O5 Description: License Activation Scheduler (sppuinotify.dll)
Event[2]:Log Name: Application Source: Microsoft-Windows Date: 2016-03-29T13:02:27.000 Event ID: 8196 Task: N/A Level: Information Opcode: N/A Keyword: Classic User: N/A User Name: N/A Computer: WIN-IONOGQTF9O5 Description: License Activation Scheduler (sppuinotify.dll)
ありがとう!
の
Get-Winevent
を使用する必要がある場合欲しいのは – Paul@Paul:返事はありがとうございます。しかし、get_eventlogとwevtutilの出力は全く異なります! –
get-eventlogが出力するイベントには、wevtutilのサンプル出力に含まれるすべての情報が含まれています。データをまとめてファイルに保存するだけです – Paul