"OldDog" <michael.r.felkins@xxxxxx> wrote in message
On Sep 5, 12:30 pm, "Pegasus \(MVP\)" <I....@xxxxxx> wrote:
> "OldDog" <michael.r.felk...@xxxxxx> wrote in message
> > I found this snippet on another group. Can someone tell me where this
> > will write the errors to?
> > Sub ReportErrors(ErrText)
> > If err.number <> 0 then
> > Set WshShell = WScript.CreateObject("WScript.Shell")
> > WshShell.LogEvent 1, ErrText & " Error code " & err.number & " (" &
> > err.description & ")"
> > Err.clear
> > End If
> > End Sub
> > The systems event log? application?
> Best to download the file "script56.chm" from the Microsoft site and use
> search function to find the string "LogEvent". It will tell you exactly
> where the message goes (and will probably answer lots of future questions
> too!).- Hide quoted text -
> - Show quoted text -
I am sure that would be a good source, however chm files do not open
on my WindowsXP Pro SP 3 desktop.
Well, they open, but the right hand screen reports an error.
"Navigation to the Web Page was cancelled."
Try opening it with this command: hh c:\script56.chm, then try to fix your
Windows help facility. In the meantime here is what the help file says:
Log Event Method
Adds an event entry to a log file.
object.LogEvent(intType, strMessage [,strTarget])
Integer value representing the event type.
String value containing the log entry text.
Optional. String value indicating the name of the computer system where the
event log is stored (the default is the local computer system). Applies to
Windows NT/2000 only.
The LogEvent method returns a Boolean value (true if the event is logged
successfully, otherwise false). In Windows NT/2000, events are logged in the
Windows NT Event Log. In Windows 9x/Me, events are logged in WSH.log
(located in the Windows directory). There are six event types.
The following code logs SUCCESS or ERROR depending on the outcome of the
Visual Basic Script Copy Code
Set WshShell = WScript.CreateObject("WScript.Shell")
rc = runLoginScript() 'Returns true if logon succeeds.
if rc then
WshShell.LogEvent 0, "Logon Script Completed Successfully"
WshShell.LogEvent 1, "Logon Script failed"
JScript Copy Code
var WshShell = WScript.CreateObject("WScript.Shell");
var rc = runLoginScript();
WshShell.LogEvent(0, "Logon Script Completed Successfully");
WshShell.LogEvent(1, "Logon Script failed");