VBScript & Windows NT Event Log 
Author Message
 VBScript & Windows NT Event Log

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



Sun, 25 Feb 2001 03:00:00 GMT  
 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



Mon, 26 Feb 2001 03:00:00 GMT  
 VBScript & Windows NT Event Log
Thanks for the information.  I will check it out.
The STAdmin.dll file can be found at:
ftp://ftp.cwashington.netreach.net/ocx_controls/event_log_manager.zip
The main site is:
http://cwashington.netreach.net/home.htm


Quote:
>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


>>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



Mon, 26 Feb 2001 03:00:00 GMT  
 
 [ 3 post ] 

 Relevant Pages 

1. VBScript & Windows NT Event Log

2. How to Retrieve Events For One Day From An Event Log on Windows 2000/NT

3. Logging events to NT Event Log from VB5

4. Event Log: Writing to the NT Event Log

5. Windows 2000/NT Event log monitoring

6. Windows 2000/NT Event log monitoring

7. Windows 2000/NT Event log monitoring

8. How-to: Log to NT Event Log

9. Writing to the Windows NT Event Log - Example please

10. Reading from the Windows NT Event Log

11. Accessing the Windows NT Event Log

12. Reading Windows NT Event Log from VB

 

 
Powered by phpBB® Forum Software