.Logevent

Log an event in the Windows event log.

Syntax 
       objShell.LogEvent intType, strMessage [,strTarget]

Arguments:

   objShell    A WScript.Shell object

   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 objShell = CreateObject("WScript.Shell")
objShell.LogEvent 4, "Script started."
objShell.LogEvent 2, "An error occured."
objShell.LogEvent 0, "Something worked."
objShell.LogEvent 1, "Something failed."

“You are no bigger then the things that annoy you” ~ Jerry Bundsen

Equivalent Windows CMD command: EVENTCREATE - Add a message to the Windows event log.


 
Copyright © 1999-2024 SS64.com
Some rights reserved