
VBScript & Windows NT Event Log
The event log is looking for a description for eventID: 123 for source:Test
Source. In other words, the event log is looking for an associated
eventMessageFile which contains descriptions for the event identifiers (ex:
123), categories, and parameters. The location for this eventMessageFile is
stored in the registry under the following key:
HKEY_LOCAL_MACHINE
SYSTEM
CurrentControlSet
Services
EventLog
Application, System, or Security
<Event Source Name> in your case "Test source"
eventMessageFile is a value in this key of type REG_EXPAND_SZ. If this
message file is not found, then it will return the exact message that you
got.
Look in the MSDN Online Library at the following address for more help
(including instructions for making a message file):
http://premium.microsoft.com/msdn/library/sdkdoc/winbase/eventlog_6jh...
I hope this helps, can you tell me where you got this STAdmin.DLL?
Allen Leis
Quote:
>I downloaded a copy of your STAdmin.DLL to manage the Windows NT event log.
>I registered your dll and tried running your sample vbscript.
>Unfortunately, I get the following message in the application log on my
>Windows NT 4.0 server:
>Event Detail:
>The description for EventID(123) in Source (Test source) could not be
>found. It contains the following insertion string(s): Fancy description
>My question is is this message correct? It complains about the description
>for an event not being found. How do I correct this? I am new to
>VBanything and would appreciate your help. I appreciate ANY help you could
>furnish. BTW, the script I ran looks like this:
>Set EventLog = CreateObject("STMAdmin.EventLog")
>EventLog.Open("System")
>EventLog.ReportEvent "Test source", 123, "Fancy description"
>WScript.Echo "Number of Records: " & EventLog.NoRecords
>'For Each rec In EventLog.Records(8)
>' PrintRecord(rec)
>'Next
>EventLog.Close()
>Sub PrintRecord(rec)
> WScript.Echo "================"
> WScript.Echo "EventID: " & rec.EventID
> WScript.Echo "Source Name: " & rec.SourceName
> WScript.Echo "Computer Name: " & rec.ComputerName
> WScript.Echo "Event String: " & rec.Event
> WScript.Echo "Strings: "
> For Each str In rec.Strings
> WScript.Echo " " & str
> Next
>End Sub