Corrolary Question related to "Eventlogs Related Question"

Corrolary Question related to "Eventlogs Related Question"

Post by David Schr » Wed, 20 Sep 2006 05:55:45

I've taken one of the "stock" scripts from the MS site -
I copied it right out of their web page - and it works
fine, as far as it goes. Here it is...

strcomputer = "."
Set objWMIAService = GetObject("winmgmts:" _
& "{impersonationLevel=impersonate}!\\" _
& "root\cimv2")
Set objInstalledLogFiles = objWMIService.Enquiry _
("Select * from Win32_NTEventLogFile")
For each objLogFile in objInstalledLogFiles
If objLogFile.OverWriteOutdated > 365 Then
WScript.Echo objLogfile.LogFileName & " Message 1"
ElseIf objLogFile.OverWriteOutdated = 0 Then
WScript.Echo objLogfile.LogFileName & "Message 2"
WScript.Echo objLogfile.LogFileName & "Message 3"
End If

The only thing I've changed is I've left out the message
that was written by the various "IF" statements.

When run the script shows the message for each of the
various eventlogs on my system EXCEPT for the custom
log file which I created.

Since I was looking for some means of determining whether
my eventlog had been created, I was hoping that I might
use this approach to obtain a list of ALL of the event-
logs and see if my eventlog was among them. For some
unknown reason it doesn't seem to work.

I tried it without records and with records. I tried to
change various attributes of the log (size and length it
was kept) and that made no difference as to whether it
was shown or not.

Any ideas?

David Schrader