WSH » wshshell » LogEvent

Syntax:
WshShell.LogEvent (intType, strMessage [,strTarget])
intType
Receives an integer corresponding to an event in the Event Types table.
strMessage
Receives the message string.
strTarget
This parameter only works on Windows NT, and specifies the name of the system where the event should be logged (the default is the local system).

The LogEvent method logs an event in the Windows NT event log or WSH.log file.

The LogEvent method logs an event in the Windows NT event log or WSH.log file. The type of the event is specified by intType (see details below). The message string is specified by strMessage. The parameter strTarget only works on Windows NT. It specifies the name of the system where the event should be logged (default is local system). This method returns True if an event is logged sucessfully, otherwise it returns False.

Event Types/b>

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

Examples

Code:
Set WshShell = CreateObject("WScript.Shell")
WshShell.LogEvent 4, "Script started."
.
.
.
WshShell.LogEvent 0, "Script completed."
Explanation:

This VBScript code illustrates the behavior of this method.

Language(s): VBScript