WMI Fun !! 〜 WMI に興味がある方・システム管理者必見! 〜 |
|
![]() |
WMI Fun !! > WMI Sample (VB) > アプリケーションイベントログから警告のみ取得する |
ATM 利用時の入出金手数料が最大 7 回/月無料、
WMI スクリプトの実行結果を VBS を利用してメールで送信する方法を公開しています パソコンに負荷のかからないウィルス対策なら ESET パーソナル セキュリティ アプリケーションイベントログから警告のみ取得する: Win32_NTLogEvent - WMI Sample (VB)Topics
アプリケーションイベントログから警告のみ取得するサンプルプログラムです。
Sample Code
Private Sub Command1_Click()
Dim EveSet As SWbemObjectSet Dim Eve As SWbemObject Dim Locator As SWbemLocator Dim Service As SWbemServices Dim MesStr As String Set Locator = New WbemScripting.SWbemLocator Set Service = Locator.ConnectServer Set EveSet = Service.ExecQuery _ ("Select * From Win32_NTLogEvent Where Logfile = 'Application' And EventType = 1") For Each Eve In EveSet MesStr = MesStr & Eve.EventCode & ": " & Eve.Message Next MsgBox "アプリケーションイベントログから警告のみを取得します。" & vbCrLf & _ vbCrLf & MesStr Set EveSet = Nothing Set Eve = Nothing Set Locator = Nothing Set Service = Nothing End Sub
![]() Comment
実行するとアプリケーションイベントログから警告タイプのログのみ抽出し表示します。 ![]() Recommended book
個人的にお勧めする本の紹介です。 ![]() |
ご意見・ご要望・ご感想をこちらのアンケートからお待ちしています |
∧ ページの先頭へ… |