'======================================== Sub zGen_LogEvent(iType, sDesc) 'Writes to the Application Event Log 'Usage: 'Call zGen_LogEvent(iType, sDesc) 'Where: 'iType = 0=Success, 1=Error, 2=Warning, 4=Information, 8=AuditSuccess, 16=AuditFailure 'sDesc = Text to appear in the description of the event properties details screen 'Note: 'The source will always show as 'WSH' 'iType MUST be 0,1,2,4,8,16 or error occurs, so forced to 1 if not in range Dim oShell, iNewType, sNewDesc Select Case iType Case 0,1,2,4,8,16 iNewType = iType sNewDesc = sDesc Case Else iNewType = 1 'Force error if not a valid log type sNewDesc = "##### WARNING #####" & vbcrlf & "Invalid Log Type Attempted: " & cStr(iType) & " -> 1 " & vbcrlf & String(30,"=") & vbcrlf & sDesc End Select Set oShell = CreateObject("WScript.Shell") oShell.LogEvent iNewType, sNewDesc Set oShell = Nothing End Sub '========================================