PowerShell/イベントログの内容を確認する・Get-EventLog
の編集
Top
/
PowerShell
/
イベントログの内容を確認する・Get-EventLog
[
トップ
] [
編集
|
差分
|
バックアップ
|
添付
|
リロード
] [
新規
|
一覧
|
検索
|
最終更新
|
ヘルプ
]
-- 雛形とするページ --
(no template pages)
#navi(../) * PowerShellでイベントログの内容を確認する・Get-EventLog [#n144cab0] イベントログの内容を表示する(取得する)Get-EventLogについて以下に記します。 #htmlinsertpcsp(win-top.html,win-sp.html) #contents * 関連記事 [#ce396f7f] -[[PowerSehllで任意のイベントログを出力する方法>PowerShell/任意のイベントログを出力する方法]] -[[PowerShellでイベントログを取得するサンプルコード>PowerShell/PowerShellでイベントログを取得するサンプルコード]] * Get-EventLogコマンドレット [#h6d5e639] PowerShell ISEでGet-EventLog -LogName と入力すると以下のスクリーンショットが表示されます。~ 各種イベントを指定して取得することができます。 #ref(01.gif) #br 尚、上記のLogNameのリストは以下のように一覧を表示することができます。(-List) PS D:\ps> Get-EventLog -List Max(K) Retain OverflowAction Entries Log ------ ------ -------------- ------- --- 20,480 0 OverwriteAsNeeded 5,747 Application 20,480 0 OverwriteAsNeeded 0 HardwareEvents 512 7 OverwriteOlder 0 Internet Explorer 20,480 0 OverwriteAsNeeded 0 Key Management Service 128 0 OverwriteAsNeeded 11 OAlerts Security 20,480 0 OverwriteAsNeeded 4,048 System 15,360 0 OverwriteAsNeeded 108 Windows PowerShell * Get-EventLogの他のオプション [#b45f249c] Get-Help Get-EventLogでみると以下の様な構文になります。 > Get-Help Get-EventLog 名前 Get-EventLog 構文 Get-EventLog [-LogName] <string> [[-InstanceId] <long[]>] [-ComputerName <string[]>] [-Newest <int>] [-After <datetime>] [-Before <datetime>] [-UserName <string[]>] [-Index <int[]>] [-EntryType <string[]> {Error | In formation | FailureAudit | SuccessAudit | Warning}] [-Source <string[]>] [-Message <string>] [-AsBaseObject] [<CommonParameters>] Get-EventLog [-ComputerName <string[]>] [-List] [-AsString] [<CommonParameters>] 上記の-Newestを例に実際に実行してみます。~ -LogName = Application PS D:\> Get-EventLog -LogName Application -Newest 3 Index Time EntryType Source InstanceID Message ----- ---- --------- ------ ---------- ------- 6397 3 31 11:12 Information Microsoft-Windows... 2003 The Windows Location Provider has succes... 6396 3 31 11:12 Information Microsoft-Windows... 2001 The Windows Location Provider has succes... 6395 3 31 11:10 Information Microsoft-Windows... 2003 The Windows Location Provider has succes... -LogName = System PS D:\> Get-EventLog -LogName System -Newest 3 Index Time EntryType Source InstanceID Message ----- ---- --------- ------ ---------- ------- 5148 3 31 10:42 Information Service Control M... 1073748864 Background Intelligent Transfer Service ... 5147 3 31 10:39 Information Microsoft-Windows... 507 ソース 'Microsoft-Windows-Kernel-Power' のイベ... 5146 3 31 10:33 Information Microsoft-Windows... 506 ソース 'Microsoft-Windows-Kernel-Power' のイベ... 以上、PowerShellでEvent Logを確認するGet-EventLogコマンドレットの紹介でした。 #htmlinsertpcsp(win-btm.html,win-sp.html)
タイムスタンプを変更しない
#navi(../) * PowerShellでイベントログの内容を確認する・Get-EventLog [#n144cab0] イベントログの内容を表示する(取得する)Get-EventLogについて以下に記します。 #htmlinsertpcsp(win-top.html,win-sp.html) #contents * 関連記事 [#ce396f7f] -[[PowerSehllで任意のイベントログを出力する方法>PowerShell/任意のイベントログを出力する方法]] -[[PowerShellでイベントログを取得するサンプルコード>PowerShell/PowerShellでイベントログを取得するサンプルコード]] * Get-EventLogコマンドレット [#h6d5e639] PowerShell ISEでGet-EventLog -LogName と入力すると以下のスクリーンショットが表示されます。~ 各種イベントを指定して取得することができます。 #ref(01.gif) #br 尚、上記のLogNameのリストは以下のように一覧を表示することができます。(-List) PS D:\ps> Get-EventLog -List Max(K) Retain OverflowAction Entries Log ------ ------ -------------- ------- --- 20,480 0 OverwriteAsNeeded 5,747 Application 20,480 0 OverwriteAsNeeded 0 HardwareEvents 512 7 OverwriteOlder 0 Internet Explorer 20,480 0 OverwriteAsNeeded 0 Key Management Service 128 0 OverwriteAsNeeded 11 OAlerts Security 20,480 0 OverwriteAsNeeded 4,048 System 15,360 0 OverwriteAsNeeded 108 Windows PowerShell * Get-EventLogの他のオプション [#b45f249c] Get-Help Get-EventLogでみると以下の様な構文になります。 > Get-Help Get-EventLog 名前 Get-EventLog 構文 Get-EventLog [-LogName] <string> [[-InstanceId] <long[]>] [-ComputerName <string[]>] [-Newest <int>] [-After <datetime>] [-Before <datetime>] [-UserName <string[]>] [-Index <int[]>] [-EntryType <string[]> {Error | In formation | FailureAudit | SuccessAudit | Warning}] [-Source <string[]>] [-Message <string>] [-AsBaseObject] [<CommonParameters>] Get-EventLog [-ComputerName <string[]>] [-List] [-AsString] [<CommonParameters>] 上記の-Newestを例に実際に実行してみます。~ -LogName = Application PS D:\> Get-EventLog -LogName Application -Newest 3 Index Time EntryType Source InstanceID Message ----- ---- --------- ------ ---------- ------- 6397 3 31 11:12 Information Microsoft-Windows... 2003 The Windows Location Provider has succes... 6396 3 31 11:12 Information Microsoft-Windows... 2001 The Windows Location Provider has succes... 6395 3 31 11:10 Information Microsoft-Windows... 2003 The Windows Location Provider has succes... -LogName = System PS D:\> Get-EventLog -LogName System -Newest 3 Index Time EntryType Source InstanceID Message ----- ---- --------- ------ ---------- ------- 5148 3 31 10:42 Information Service Control M... 1073748864 Background Intelligent Transfer Service ... 5147 3 31 10:39 Information Microsoft-Windows... 507 ソース 'Microsoft-Windows-Kernel-Power' のイベ... 5146 3 31 10:33 Information Microsoft-Windows... 506 ソース 'Microsoft-Windows-Kernel-Power' のイベ... 以上、PowerShellでEvent Logを確認するGet-EventLogコマンドレットの紹介でした。 #htmlinsertpcsp(win-btm.html,win-sp.html)
テキスト整形のルールを表示する
添付ファイル:
01.gif
818件
[
詳細
]