Adds an event entry to a log file.
|
---|
object.LogEvent(intType, strMessage [,strTarget]) |
Arguments
- object
WshShell object.
- intType
Integer value representing the event type.
- strMessage
String value containing the log entry text.
- strTarget
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.
Remarks
Example
The following code logs SUCCESS or ERROR depending on the outcome of the function runLoginScript().
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"
else
WshShell.LogEvent 1, "Logon Script failed"
end if |
JScript | Copy Code |
---|
var WshShell = WScript.CreateObject("WScript.Shell");
var rc = runLoginScript();
if (rc)
WshShell.LogEvent(0, "Logon Script Completed Successfully");
else
WshShell.LogEvent(1, "Logon Script failed"); |
See Also