Home NT WSH
WshShell.Logevent

Log an event in the Windows NT event log or WSH.log file.

Syntax 
       WshShell.LogEvent intType, strMessage [,strTarget]

Arguments:

   intType    = The type of the event is specified by
                (see details below).

   strMessage = The message string is specified by.

   strTarget  = The name of the system where the event should be logged
                (default is local system).

intType    
  0  SUCCESS
  1  ERROR
  2  WARNING
  4  INFORMATION
  8  AUDIT_SUCCESS
 16  AUDIT_FAILURE

Returns True if an event is logged sucessfully, otherwise it returns False.

Examples

Set WshShell = CreateObject("WScript.Shell")
WshShell.LogEvent 4, "Script started."
WshShell.LogEvent 2, "An error occured."
WshShell.LogEvent 0, "Something worked."
WshShell.LogEvent 1, "Something failed."

You are no bigger then the things that annoy you. Jerry Bundsen

Related commands:


Equivalent Windows NT command:

LOGEVENT - Write text to the NT event viewer.
EVENTCREATE - Create a custom event log message (Windows XP)



Back to the Top

Simon Sheppard
SS64.com