基本的な使い方 |
Get-EventLog "ログ名" |
PS C:\> Get-EventLog System |
Index Time EntryType Source InstanceID Message |
----- ---- --------- ------ ---------- ------- |
19198 10 24 13:43 Information Service Control M... 1073748860 Application Experience サービスは 停止 状態に移... |
19197 10 24 13:42 Information Service Control M... 1073748860 WinHTTP Web Proxy Auto-Discovery Service サービ... |
19196 10 24 13:33 Information Service Control M... 1073748860 Application Experience サービスは 実行中 状態に... |
19195 10 24 13:26 Warning NETLOGON 5807 IP アドレスがエンタープライズの既存のどのサイト... |
19194 10 24 13:26 Error NETLOGON 5719 次の理由のため、このコンピューターはドメイン AR... |
19193 10 24 13:26 Error NETLOGON 5719 次の理由のため、このコンピューターはドメイン EU... |
19192 10 24 13:26 Warning NETLOGON 5781 ... |
fl をつけるとリスト形式になります。 |
PS C:\> Get-EventLog System | fl |
Index : 19198 |
EntryType : Information |
InstanceId : 1073748860 |
Message : Application Experience サービスは 停止 状態に移行しました。 |
Category : (0) |
CategoryNumber : 0 |
ReplacementStrings : {Application Experience, 停止} |
Source : Service Control Manager |
TimeGenerated : 2015/10/24 13:43:34 |
TimeWritten : 2015/10/24 13:43:34 |
UserName : |
Index : 19197 |
EntryType : Information |
InstanceId : 1073748860 |
Message : WinHTTP Web Proxy Auto-Discovery Service サービスは 停止 状態に移行しました。 |
Category : (0) |
CategoryNumber : 0 |
ReplacementStrings : {WinHTTP Web Proxy Auto-Discovery Service, 停止} |
Source : Service Control Manager |
TimeGenerated : 2015/10/24 13:42:02 |
TimeWritten : 2015/10/24 13:42:02 |
UserName : |
以下・・・繰り返しになります。 |
フィルター機能で、Indexが特定の値のものを抽出してみましょう。 |
フィルターは、 ?{ }です。 「 $_. 」 は直近で取得した値が格納される配列です。非常にお手軽です。 |
PS C:\> Get-EventLog System | ?{$_.Index -eq 19150} |
Index Time EntryType Source InstanceID Message |
----- ---- --------- ------ ---------- ------- |
19150 10 18 17:27 Information Service Control M... 1073748860 Certificate Propagation サービスは 実行中 状態... |
上記のリスト形式です。 |
PS C:\> Get-EventLog System | ?{$_.Index -eq 19150} | fl |
Index : 19150 |
EntryType : Information |
InstanceId : 1073748860 |
Message : Certificate Propagation サービスは 実行中 状態に移行しました。 |
Category : (0) |
CategoryNumber : 0 |
ReplacementStrings : {Certificate Propagation, 実行中} |
Source : Service Control Manager |
TimeGenerated : 2015/10/18 17:27:16 |
TimeWritten : 2015/10/18 17:27:16 |
UserName : |
Where-Object が一応正式なフィルターの記述です。 |
慣れると「?」の記述一択になっていくかもしれませんが、正式な記述も覚えておきましょう。 |
PS C:\> Get-EventLog System | Where-Object {$_.Message -like "*Remote*"} |
Index Time EntryType Source InstanceID Message |
----- ---- --------- ------ ---------- ------- |
119817 10 16 23:46 Information Service Control M... 1073748860 Remote Desktop Services UserMode Port Redirecto... |
119814 10 16 23:46 Information Service Control M... 1073748860 Remote Desktop Configuration サービスは 実行中 ... |
119795 10 16 23:46 Information Service Control M... 1073748860 Remote Desktop Services サービスは 実行中 状態... |
119747 10 16 23:45 Information Service Control M... 1073748860 Remote Procedure Call (RPC) サービスは 実行中 ... |
119727 10 16 23:44 Information Service Control M... 1073748860 Remote Desktop Services サービスは 停止 状態に... |
119713 10 16 23:44 Information Service Control M... 1073748860 Remote Desktop Services UserMode Port Redirecto... |
119419 10 15 20:43 Information Service Control M... 1073748860 Remote Desktop Services UserMode Port Redirecto... |
119416 10 15 20:43 Information Service Control M... 1073748860 Remote Desktop Configuration サービスは 実行中 ... |
119399 10 15 20:43 Information Service Control M... 1073748860 Remote Desktop Services サービスは 実行中 状態... |
119350 10 15 20:42 Information Service Control M... 1073748860 Remote Procedure Call (RPC) サービスは 実行中 ... |
アクセス権さえクリアできれば、下記のようにリモートコンピューターのイベントログさえも調査することができます。 |
PS C:\> Get-EventLog -ComputerName dctk1.hopu.local System | Where-Object {$_.Message -like "*Remote*"} |
Index Time EntryType Source InstanceID Message |
----- ---- --------- ------ ---------- ------- |
19166 10 18 17:29 Information Service Control M... 1073748860 Windows Remote Management (WS-Management) サー... |
19152 10 18 17:27 Information Service Control M... 1073748860 Remote Desktop Services UserMode Port Redirecto... |
19149 10 18 17:27 Information Service Control M... 1073748860 Remote Desktop Configuration サービスは 実行中 ... |
19143 10 18 17:27 Information Service Control M... 1073748860 Remote Desktop Services サービスは 実行中 状態... |
19116 10 18 17:26 Information Service Control M... 1073748860 Remote Registry サービスは 実行中 状態に移行し... |
19079 10 18 17:25 Information Service Control M... 1073748860 Remote Procedure Call (RPC) サービスは 実行中 ... |
19057 10 18 17:24 Information Service Control M... 1073748860 Windows Remote Management (WS-Management) サー... |
19054 10 18 17:24 Information Service Control M... 1073748860 Remote Desktop Services サービスは 停止 状態に... |
とりあえずは、イベントログを抽出したいけれども名称が不明な場合は、ワイルドカードで一覧を表示しましょう。 |
PS C:\> Get-EventLog * |
Max(K) Retain OverflowAction Entries Log |
------ ------ -------------- ------- --- |
512 7 OverwriteOlder 274 Active Directory Web Services |
512 0 OverwriteAsNeeded 1,864 ADAM (instance1) |
512 0 OverwriteAsNeeded 1,710 ADAM (instance2) |
512 0 OverwriteAsNeeded 1,977 ADAM (instance3) |
512 0 OverwriteAsNeeded 124 ADAM (instance5) |
20,480 0 OverwriteAsNeeded 3,879 Application |
15,168 0 OverwriteAsNeeded 595 DFS Replication |
512 0 OverwriteAsNeeded 2,681 Directory Service |
16,384 0 OverwriteAsNeeded 179 DNS Server |
20,480 0 OverwriteAsNeeded 0 HardwareEvents |
512 7 OverwriteOlder 0 Internet Explorer |
20,480 0 OverwriteAsNeeded 0 Key Management Service |
Security |
20,480 0 OverwriteAsNeeded 19,199 System |
512 0 OverwriteAsNeeded ThinPrint Diagnostics |
15,360 0 OverwriteAsNeeded 96 Windows PowerShell |
鉄則ですが、スペースが入るような名称の場合は「"」(ダブルクォーテーション)で囲むことを忘れずにです。 |
PS C:\> Get-EventLog DFS Replication |
Get-EventLog : パラメーター 'InstanceId' をバインドできません。値 "Replication" を型 "System.Int64" に変換できません。 |
エラー: "入力文字列の形式が正しくありません。" |
発生場所 行:1 文字:13 |
+ Get-EventLog <<<< DFS Replication |
+ CategoryInfo : InvalidArgument: (:) [Get-EventLog]、ParameterBindingException |
+ FullyQualifiedErrorId : CannotConvertArgumentNoMessage,Microsoft.PowerShell.Commands.GetEventLogCommand |
表示されました。 |
PS C:\> Get-EventLog "DFS Replication" |
Index Time EntryType Source InstanceID Message |
----- ---- --------- ------ ---------- ------- |
595 10 18 17:27 Information DFSR 1073743034 DFS レプリケーション サービスは、レプリケーショ... |
594 10 18 17:27 Information DFSR 1073743030 DFS レプリケーション サービスは、ドメイン コン... |
593 10 18 17:27 Information DFSR 1073747926 DFS レプリケーション サービスは、WMI プロバイダ... |
592 10 18 17:26 Information DFSR 1073743138 DFS レプリケーション サービスは、デバッグ ログ ... |
591 10 18 17:26 Information DFSR 1073742828 DFS レプリケーション サービスを開始しました。 |
★CentOS7 まとめ
★Ubuntu14 まとめ
★Ubuntu12用無線アダプタ紹介
★Ubuntu12 まとめ
★Server 2008R2 まとめ
★SCCM2012R2 まとめ
★Windows10 アップグレード
★Windows7 まとめ
★Windows7 SSD まとめ
★Windows8 まとめ
★EaseUS Todo Backup Server
★Linux Destbision まとめ
★Linuxコマンド関連Index
★Zorin8.1まとめ
★Fedora17まとめ
★Fedora15まとめ
☆VB Script まとめ
★USB3.0で快適バックアップ
★リンク集・メール
・はじめての自宅サーバ構築 - Fedora/CentOS -
SCCM Backup 遠隔操作 VirtualBox FeliCaポート/パソリ ESXi
<%plugin_third_description>
<%plugin_third_content><%plugin_third_description2>