Je voudrais analyser le journal des événements d'une application Windows spéciale (Windows 7 Enterprise, 64Bit).Instruction WQL pour vérifier le journal des événements d'une application
J'ai besoin d'un événement spécial enregistré il y a quelques secondes.
Voici mon code VBScript, qui produit un résultat complètement faux (mauvais nombre d'événements):
strComputer = "." ' Dieser Computer
' Retrieving Specific Events from an Event Log
Set objWMIService = GetObject("winmgmts:" & "{impersonationLevel=impersonate}!\" & strComputer & "\root\cimv2")
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)
...
Le nombre de lignes (Anzahl = colLoggedEvents.count) doit être 0 ou 1, quoi que ce soit d'autre est impossible.
Quel est le problème avec l'instruction wql? Je voudrais vérifier les dernières secondes dans le passé (à partir de maintenant).
Merci.
Tommy