wntEventWrite

Writes an entry to an NT event log.

Syntax:

wntEventWrite( server-name, source-name, type/category, event-id, description)

Parameters:

(s) server-name: the UNC name of the server on which the function will execute (eg, "\\MYSERVER"), or a blank string ("") to indicate the current machine.

(s) source-name: a subkey of a logfile entry under the "EventLog" key in the registry (see below).

(i) type/category: consists of one value for "type" and one value for "category", combined with the bitwise OR ('|') operator (see below)

(i) event-id: the event identifier. The event identifier specifies the message that goes with this event as an entry in the message file associated with the event source.

(s) description: an optional string containing additional information that will be stored with the event, or "".

Returns:

(i) 1

 

"source-name" is a subkey of a logfile entry under the "EventLog" key in the registry. For example, the source name "WinApp" would be valid if the registry had the following form:

 

HKEY_LOCAL_MACHINE\System\CurrentControlSet\Services\EventLog\WinApp

 

Or you could specify any one of the following logs:

 

Application 

Security 

System 

 

If the source name cannot be found, the event logging service uses the Application logfile with no message files for the event identifier or category.

 

"type/category" consists of one value for "type" and one value for "category", combined with the bitwise OR ('|') operator:

 

type: specifies the type of event being logged, and can be one of the following values:

 

Value

Meaning

65536

EVENTLOG_ERROR_TYPE

131072

EVENTLOG_WARNING_TYPE

262144

EVENTLOG_INFORMATION_TYPE

524288

EVENTLOG_AUDIT_SUCCESS

1048576

EVENTLOG_AUDIT_FAILURE

 

category: specifies the event category. This is source-specific information; the category can have any value (0 - 65535).

 

Example:
; Load Appropriate Extender
AddExtender('wwwnt34i.dll',0,'wwwnt64i.dll')

;In order to run this script, you will need to have created and compiled a ;message file defining a message #15, otherwise the event will say "message ;not found" and it will also include the specified string (ie, "Unexpected ;response"). wntEventWrite(SERVER, "My Monitor", 262144, 15, "Unexpected response") Exit
See Also:

wntEventLog, Complete list of NT functions