Pregunta

  1. i am querying for event viewer log using vbscript.
    1. When I try ot use OR operator @ Where Logfile='System' Or 'Application' it gives info but drops TYPE condition and i found my results with information type data.
    2. How do i combine this two queries so that I don't have to write extra code.

Set colLoggedEvents = objWMIService.ExecQuery _
        ("Select * from Win32_NTLogEvent Where Logfile = 'Application'  AND Type <> 'Information' AND TimeGenerated >  ' " & dteDate & "' ")
Set colLoggedEvents = objWMIService.ExecQuery _
            ("Select * from Win32_NTLogEvent Where Logfile = 'System'  AND Type <> 'Information' AND TimeGenerated >  ' " & dteDate & "' ")

regards : msinfo

¿Fue útil?

Solución

You can use parentheses for an inner comparison.

Select * from Win32_NTLogEvent Where ( Logfile = 'System' Or Logfile = 'Application' ) AND Type <> 'Information' AND TimeGenerated > '" & dteDate & "'

Licenciado bajo: CC-BY-SA con atribución
No afiliado a StackOverflow
scroll top