
イベントログにイベントを書き込むには、Write-EventLogを使用します。
構文
Write-EventLog -LogName <ログ名> -Source <ソース名> -EventID <イベントID> -Message <イベントメッセージ>
例
1 | PS C:\work> Write -EventLog -LogName "TestLog" -Source "TestApp" -EventID 1001 -Message "This is a test message." |
1 2 3 4 5 | PS C:\work> Get-EventLog -LogName "TestLog" Index Time EntryType Source InstanceID Message ----- ---- --------- ------ ---------- ------- 4 1 09 18:48 Information TestApp 1001 This is a test message. |
スポンサーリンク