خرید بک لینک

Vote count: 0

I would like to analyze the event log of a special windows application (Windows 7 Enterprise, 64Bit).

I need a special event which is logged some seconds ago.

Here is my VBScript code, which produces a completely wrong result (wrong number of events):

strComputer = "." ' Dieser Computer

' Retrieving Specific Events from an Event Log

Set objWMIService = GetObject("winmgmts:" & "{impersonationLevel=impersonate}!" & strComputer & "rootcimv2")

Const CONVERT_TO_LOCAL_TIME = True

Set dtmStartDate = CreateObject("WbemScripting.SWbemDateTime") Set dtmEndDate = CreateObject("WbemScripting.SWbemDateTime")

dtmStartDate.SetVarDate dateadd("s", -10, now()) ' CONVERT_TO_LOCAL_TIME dtmEndDate.SetVarDate now() ' CONVERT_TO_LOCAL_TIME

dim var_wql

var_wql = "SELECT * FROM Win32_NTLogEvent WHERE Logfile = '< ... >' AND SourceName = '< ... >' AND EventCode = '< ... >' AND (TimeWritten >= '" & dtmStartDate & "') AND (TimeWritten < '" & dtmEndDate & "')"

Set colLoggedEvents = objWMIService.ExecQuery(var_wql)

...

The number of rows (anzahl = colLoggedEvents.count) must be 0 or 1, anything else is impossible.

What is wrong with the wql statement? I would like to check the last seconds in the past (from now).

Thanks.

Tommy

asked 9 secs ago

برچسب: نویسنده: استخدام کار تاريخ: چهارشنبه 10 شهريور 1395 ساعت: 13:33

صفحه بندی