I am writing a VBScript which attempts to query the WMI system logs for start up and shutdowns within the current month and unfortunately I'm hitting an automation error with the query I have created.
I have a function that will dynamically create a UTC for the start and end of the month (at least I think it does and it looks right) and then add it to the query string, which looks like this:
Select * from Win32_NTLogEvent
Where Logfile = 'System' and
(EventCode = '12' or EventCode = '13') AND
(TimeWritten is between '2015101000000.000000-000' and '2015131235959.000000-000')
I have tried substituting the single quotes for double quotes (using CHR(34)
as I don't know any better).
I hoped somebody may be able to point out the error in my ways and explain why this query is not working.