OVH Cloud OVH Cloud

pb requête WMI

2 réponses
Avatar
AQWERTY
Bonjour,

Cette requête qui me permet de récupérer les logs de J-1 ne fonctionne plus
(retourne Null) dès que j'ajoute la condition LogFileName='Application'

Ligne = "Select * from Win32_NTLogEvent Where LogFileName=" & "'" &
"Application" & "'" & " and (TimeWritten >= '" & dtmStartDate & "' and
TimeWritten < '" & dtmEndDate & "')"

wscript.Echo ligne

Set colEvents = objWMIService.ExecQuery(ligne)

auriez-vous une idée ?

Merci,

2 réponses

Avatar
Gilles LAURENT
"AQWERTY" a écrit dans le message de
news:
| Bonjour,

Bonjour,

| Cette requête qui me permet de récupérer les logs de J-1 ne
| fonctionne plus (retourne Null) dès que j'ajoute la condition
| LogFileName='Application'
[...]

Ci-dessous un transcript WSH qui devrait vous mettre de corriger votre
petite erreur ;-)

*******************************
WSH Transcript Start
Start time : 2007-01-19 14:35:23
Username : xxxAdministrateur
Machine : xxx (Microsoft Windows NT 5.1.2600.1)
*******************************
Transcript started, output file is wmi.txt

WSH D:Test> set owmi=go("winmgmts:Win32_NTLogEvent")
WSH D:Test> gm(owmi)
xxxROOTcimv2:Win32_NTLogEvent

Property Category
Property CategoryString
Property ComputerName
Property Data
Property EventCode
Property EventIdentifier
Property EventType
Property InsertionStrings
Property *Logfile*
Property Message
Property RecordNumber
Property SourceName
Property TimeGenerated
Property TimeWritten
Property Type
Property User
WSH D:Test>

Transcript stopped.

--
Gilles LAURENT
http://glsft.free.fr
Avatar
AQWERTY
Ah oui effectivement ça marche mieux avec LogFile pourtant j'avais pris
l'exemple sur le script Center.

Merci infiniment.

"Gilles LAURENT" a écrit dans le message de news:
euH%
"AQWERTY" a écrit dans le message de
news:
| Bonjour,

Bonjour,

| Cette requête qui me permet de récupérer les logs de J-1 ne
| fonctionne plus (retourne Null) dès que j'ajoute la condition
| LogFileName='Application'
[...]

Ci-dessous un transcript WSH qui devrait vous mettre de corriger votre
petite erreur ;-)

*******************************
WSH Transcript Start
Start time : 2007-01-19 14:35:23
Username : xxxAdministrateur
Machine : xxx (Microsoft Windows NT 5.1.2600.1)
*******************************
Transcript started, output file is wmi.txt

WSH D:Test> set owmi=go("winmgmts:Win32_NTLogEvent")
WSH D:Test> gm(owmi)
xxxROOTcimv2:Win32_NTLogEvent

Property Category
Property CategoryString
Property ComputerName
Property Data
Property EventCode
Property EventIdentifier
Property EventType
Property InsertionStrings
Property *Logfile*
Property Message
Property RecordNumber
Property SourceName
Property TimeGenerated
Property TimeWritten
Property Type
Property User
WSH D:Test>

Transcript stopped.

--
Gilles LAURENT
http://glsft.free.fr