Quantcast
Channel: AutoIt v3 - General Help and Support
Viewing all articles
Browse latest Browse all 12506

sql query eventviewer logs

$
0
0
hello world

i am not sure why I am not getting results from this.. when in fact there are errors that fit the criteria

[ autoit ]         
$host = "localhost" $objWMIService = ObjGet("winmgmts:\\" & $host & "\root\cimv2") $past_15days = _DateAdd("D", -15, _NowCalc()) $past_15days = StringReplace($past_15days, "/", "") $past_15days = StringReplace($past_15days, ":", "") $past_15days = StringStripWS($past_15days, 8) $Query_Clause = "Select * FROM Win32_NTLogEvent WHERE Logfile='Application' AND Type='Error' AND TimeWritten>'" & $past_15days & "'" $colItems = $objWMIService.ExecQuery($Query_Clause) $count = 0 If IsObj($colItems) Then For $objEvent In $colItems ;~  $time_stamp = $objEvent.TimeWritten ;~  debug($time_stamp, $past_15days) $error = $objEvent.Message consolewrite($error & @crlf) $count += 1 Next EndIf

I tried with and without the single quotes around $past_15days

I know I can probably do this in one shot (getting the count which I have not been able to try yet since I cannot get accurate results)

thanks in advance!

Viewing all articles
Browse latest Browse all 12506

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>