Imports System.Diagnostics.Eventing.Reader Imports System.Text Public Enum LogAttribute Application = 1 System = 2 Setup = 3 Security = 4 End Enum Public Class EventViewer Public cDomain As String = "" Public cMessage As String = "" Public cPassword As String = "" Public cQuerystring As String = "" Public cResult As String = "" Public cServer As String = "" Public cSource As String = "" Public cUsername As String = "" Public lBookmark As Boolean = True Public lActivityID As Boolean = True Public lAscending As Boolean = True Public lComputer As Boolean = True Public lKeyword As Boolean = True Public lKeywordDisplayName As Boolean = True Public lLevel As Boolean = True Public lLevelCritical As Boolean = True Public lLevelDisplayName As Boolean = True Public lLevelError As Boolean = True Public lLevelInformation As Boolean = False Public lLevelWarning As Boolean = True Public lLogError As Boolean = True Public lOpCode As Boolean = True Public lOpCodeDisplayName As Boolean = True Public lProcessID As Boolean = True Public lProperty As Boolean = True Public lProviderID As Boolean = True Public lQualifier As Boolean = True Public lRecordID As Boolean = True Public lRelatedActivityID As Boolean = True Public lSource As Boolean = True Public lTransferToTable As Boolean = False Public lTask As Boolean = True Public lTaskDisplayName As Boolean = False Public lThreadID As Boolean = True Public lTimeCreated As Boolean = True Public lUser As Boolean = False Public lVersion As Boolean = True Public nDelay As Integer = 250 Public nRetry As Integer = 8 Public nEventID As Integer = 0 Public nHour As Integer = 24 Public nLog As LogAttribute Public nNoServer As Integer = 0 Public nRecordID As Integer = 0 Public nType As EventLogEntryType = EventLogEntryType.Information Private cUnableToConnectToServer As String = "" Private cYouNeedToDefineTheCLogProperty As String = "" Private cYouNeedToDefineTheNHourProperty As String = "" Private cYouNeedToDefineTheNNoServerProperty As String = "" Private nLanguage As Integer = 1 Private oApp As App = Nothing Private oLogData As LogData = Nothing Private oProcess As LXProcess = Nothing ' This is when we access the class in a desktop mode Sub New(ByVal toApplication As App) oApp = toApplication nLanguage = oApp.nLanguage Init() End Sub ' This is when we access the class in a Web or Web Service mode Sub New(ByVal toProcess As LXProcess) oProcess = toProcess oApp = oProcess.oApp nLanguage = oProcess.nLanguage Init() End Sub ' Save the log attribute being used Friend Sub New(ByVal tnLog As LogAttribute) nLog = tnLog End Sub ' Initialization Private Function Init() As Boolean ' Based on the language Select Case nLanguage ' English Case 1 cUnableToConnectToServer = "Unable to connect to server ##Server##." cYouNeedToDefineTheCLogProperty = "You need to define the cLog property." cYouNeedToDefineTheNHourProperty = "You need to define the nHour or nRecordID property." cYouNeedToDefineTheNNoServerProperty = "You need to define the nNoServer property." ' French Case 2 cUnableToConnectToServer = "Impossible de connecter au serveur ##Server##." cYouNeedToDefineTheCLogProperty = "Vous devez définir la propriété cLog." cYouNeedToDefineTheNHourProperty = "Vous devez définir la propriété nHour ou nRecordID." cYouNeedToDefineTheNNoServerProperty = "Vous devez définir la propriété nNoServer ou nRecordID." ' Spanish Case 3 cUnableToConnectToServer = "Unable to connect to server ##Server##." cYouNeedToDefineTheCLogProperty = "You need to define the cLog property." cYouNeedToDefineTheNHourProperty = "You need to define the nHour or nRecordID property." cYouNeedToDefineTheNNoServerProperty = "You need to define the nNoServer property." ' Portuguese Case 4 cUnableToConnectToServer = "Unable to connect to server ##Server##." cYouNeedToDefineTheCLogProperty = "You need to define the cLog property." cYouNeedToDefineTheNHourProperty = "You need to define the nHour or nRecordID property." cYouNeedToDefineTheNNoServerProperty = "You need to define the nNoServer property." End Select Return True End Function ' Add an entry in the log Public Function Add() As Boolean Dim lcLog As String = "" Dim loEventLog As EventLog = New EventLog() ' Reset the values cMessage = "" ' Based on the log Select Case nLog ' Application Case 1 lcLog = "Application" ' System Case 2 lcLog = "System" End Select ' If the event log does not exist If Not EventLog.SourceExists(cSource) Then ' Create log EventLog.CreateEventSource(cSource, lcLog) End If ' Write to the log EventLog.WriteEntry(cSource, cMessage, nType, nEventID) Return True End Function ' Retrieve events from the log ' ' Select all events in the Application Event Log where Event Level is CRITICAL or ERROR in the last 30 days ' <QueryList><Query Id="0" Path="Application"><Select Path="Application">*[System[(Level=1 or Level=2 ) and TimeCreated[timediff(@SystemTime) <= 2592000000]]]</Select></Query></QueryList> ' ' Select all events in the Application Event Log where the Provider is'.NET Runtime' and the Event Level is critcal ' <QueryList><Query Id="0" Path="Application"><Select Path="Application">*[System[Provider[@Name='.NET Runtime'] and (Level=1 )]]</Select></Query></QueryList> ' ' Select all events in the Security Event Log where the account name involved (TargetUserName) is "JUser" ' <QueryList><Query Id="0" Path="Security"><Select Path="Security">*[EventData[Data[@Name="TargetUserName"]="JUser"]]</Select></Query></QueryList> ' ' Select all events in the Security Event Log where any Data node of the EventData section is the string "JUser" ' <QueryList><Query Id="0" Path="Security"><Select Path="Security">*[EventData[Data="JUser"]]</Select></Query></QueryList> ' ' Select all events in the Security Event Log where any Data node of the EventData section is "JUser" or "JDoe" ' <QueryList><Query Id="0" Path="Security"><Select Path="Security">*[EventData[Data="JUser" or Data="JDoe"]]</Select></Query></QueryList> ' ' Select all events in the Security Event Log where any Data node of the EventData section is "JUser" and the Event ID is "4471" ' <QueryList><Query Id="0" Path="Security"><Select Path="Security">*[System[EventID="4771"]] and *[EventData[Data="JUser"]]</Select></Query></QueryList> ' ' Real world example for a package called Goldmine which has two @Names ' <QueryList><Query Id="0" Path="Application"><Select Path="Application">*[System[Provider[@Name='GoldMine' or @Name='GMService']]]</Select></Query></QueryList> ' ' Select all events in the Application Event Log where the ' <QueryList><Query Id="0" Path="Application"><Select Path="Microsoft-Windows-GroupPolicy/Operational">*[System/Correlation/@ActivityID='4000']</Select></Query></QueryList> ' Public Function RetrieveEvent() As Boolean Dim lcDomain As String = "" Dim lcLevel As String = "" Dim lcLog As String = "" Dim lcMessage As String = "" Dim lcPassword As String = "" Dim lcQueryString As String = "" Dim lcServer As String = "" Dim lcUsername As String = "" Dim lcWhere As String = "" Dim llSuccess As Boolean = False Dim lnCounter As Integer = 0 Dim lnDelay As Integer = 0 Dim lnLevel As Integer = 0 Dim lnNoEventViewerLevel As Integer = 0 Dim lnRecordID As Integer = 0 Dim lnRetry As Integer = 0 Dim lnTimeFrame As Double = 0 Dim loData As Data = Nothing Dim loEventLogQuery As EventLogQuery = Nothing Dim loEventLogReader As EventLogReader = Nothing Dim loEventLogRecord As EventLogRecord = Nothing Dim loEventLogSession As EventLogSession = Nothing Dim loEventRecord As EventRecord = Nothing Dim loInsertRow As InsertRow = Nothing Dim loLogData As LogData = Nothing Dim loRow As DataRow = Nothing Dim loSecurity As Security = Nothing Dim loStringBuilder As StringBuilder = New StringBuilder Dim loUpdate As Update = Nothing ' Get the proper definition as per the current scope If oProcess Is Nothing Then loData = New Data(oApp) loInsertRow = New InsertRow(oApp) loLogData = New LogData(oApp) loSecurity = New Security(oApp) loUpdate = New Update(oApp) Else loData = New Data(oProcess) loInsertRow = New InsertRow(oProcess) loLogData = New LogData(oProcess) loSecurity = New Security(oProcess) loUpdate = New Update(oProcess) End If ' Reset the values cMessage = "" cQuerystring = "" cResult = "" ' Initialization lcDomain = Trim(cDomain) lcPassword = Trim(cPassword) lcServer = Trim(cServer) lcUsername = Trim(cUsername) lnRecordID = nRecordID lnTimeFrame = nHour lnDelay = nDelay lnRetry = nRetry ' If the delay is lower than 250 If lnDelay < 250 Then lnDelay = 250 End If ' If the retry is lower than 8 If lnRetry < 8 Then lnRetry = 8 End If ' Based on the log Select Case nLog ' Application Case 1 lcLog = "Application" ' System Case 2 lcLog = "System" ' Setup Case 3 lcLog = "Setup" ' Security Case 4 lcLog = "Security" End Select ' If the cLog property has not been defined If lcLog.Length = 0 Then cMessage = cYouNeedToDefineTheCLogProperty Return False End If ' If the nHour property has not been defined If lnTimeFrame = 0 Then ' If the nRecordID property has not been defined If lnRecordID = 0 Then cMessage = cYouNeedToDefineTheNHourProperty Return False End If End If ' If we transfer to table If lTransferToTable Then ' If the nNoServer has not been defined If nNoServer = 0 Then cMessage = cYouNeedToDefineTheNNoServerProperty Return False End If End If ' If we need the critical messages If lLevelCritical Then lcLevel = "Level=1" End If ' If we need the error messages If lLevelError Then ' If we have a level If lcLevel.Length > 0 Then lcLevel = lcLevel + " or " End If lcLevel = lcLevel + "Level=2" End If ' If we need the warning messages If lLevelWarning Then ' If we have a level If lcLevel.Length > 0 Then lcLevel = lcLevel + " or " End If lcLevel = lcLevel + "Level=3" End If ' If we need the information messages If lLevelInformation Then ' If the log is Application or System or Setup If nLog = 1 Or nLog = 2 Or nLog = 3 Then ' If we have a level If lcLevel.Length > 0 Then lcLevel = lcLevel + " or " End If lcLevel = lcLevel + "Level=0 or Level=4" End If End If ' If the nHour property has been defined If lnTimeFrame > 0 Then lnTimeFrame = lnTimeFrame * 60 * 60 lnTimeFrame = lnTimeFrame * 1000 lcWhere = " *[System[(" + lcLevel + ") and TimeCreated[timediff(@SystemTime) <= " + lnTimeFrame.ToString + "]]]" + oApp.cCR Else lcWhere = " *[System[(" + lcLevel + ") and EventRecordID>" + lnRecordID.ToString + "]]" + oApp.cCR End If ' Initialization lcQueryString = "<QueryList>" + oApp.cCR + _ " <Query Id=""0"" Path=""" + lcLog + """>" + oApp.cCR + _ " <Select Path=""" + lcLog + """>" + oApp.cCR + _ lcWhere + _ " </Select>" + oApp.cCR + _ " </Query>" + oApp.cCR + _ "</QueryList>" ' Add the log loLogData.cLog = lcQueryString If Not loLogData.AddLog() Then End If Try ' If we have a username If lcUsername.Length > 0 Then ' If we cannot execute the method loSecurity.cString = lcPassword If Not loSecurity.GetSecureString() Then cMessage = loSecurity.cMessage Return False End If loEventLogSession = New EventLogSession(lcServer, lcDomain, lcUsername, loSecurity.oSecureString, SessionAuthentication.[Default]) End If loEventLogQuery = New EventLogQuery(lcLog, PathType.LogName, lcQueryString) ' If this is the ascending order If lAscending Then Else loEventLogQuery.ReverseDirection = True End If ' If we have a username If lcUsername.Length > 0 Then loEventLogQuery.Session = loEventLogSession End If ' For each retry For lnCounter = 1 To lnRetry ' If we cannot connect to the server ' This command may choke for a longer time on specific server up to 25 seconds per try Try loEventLogReader = New EventLogReader(loEventLogQuery) Catch loException As Exception ' If we have not reached the maximum tries of 8, we retry If lnCounter < lnRetry Then ' Wait for a timeout before retrying System.Threading.Thread.Sleep(lnDelay) Continue For End If lcMessage = cUnableToConnectToServer lcMessage = oApp.StrTran(lcMessage, "##Server##", lcServer) ' If we log the error If lLogError Then ' Get the proper definition as per the current scope If oProcess Is Nothing Then oApp.ErrorSetup(loException, lcMessage) Else oProcess.ErrorSetup(loException, lcMessage) End If End If cMessage = lcMessage Exit For End Try ' Initialization loEventRecord = loEventLogReader.ReadEvent() ' For each record While Not loEventRecord Is Nothing ' Cast the EventRecord object as an EventLogRecord object to access the EventLogRecord class properties loEventLogRecord = CType(loEventRecord, EventLogRecord) ' Initialization lnLevel = Val(loEventRecord.Level.ToString) ' If we transfer into a table If lTransferToTable Then ' Based on the level Select Case lnLevel ' Information Case 0, 4 lnNoEventViewerLevel = 1 ' Critical Case 1 lnNoEventViewerLevel = 4 ' Error Case 2 lnNoEventViewerLevel = 2 ' Warning Case 3 lnNoEventViewerLevel = 3 End Select ' Get the EventViewer record loData.ParameterAdd("RecordID", loEventRecord.Id, , "EventViewer", "RecordID") If Not loData.SQLExec("SELECT EventViewer.Numero " + _ "FROM EventViewer " + _ "WHERE EventViewer.RecordID=" + loData.ParameterAddSQL("RecordID")) Then Return False End If ' If we did not find it If loData.nCount = 0 Then ' Insert a record in EventViewer loInsertRow.cTable = "EventViewer" loInsertRow.ParameterAdd("NoServer", nNoServer) loInsertRow.ParameterAdd("NoEventViewerLog", nLog) loInsertRow.ParameterAdd("NoEventViewerLevel", lnNoEventViewerLevel) loInsertRow.ParameterAdd("ID", loEventRecord.Id) loInsertRow.ParameterAdd("Source", loEventRecord.ProviderName) loInsertRow.ParameterAdd("Description", loEventRecord.FormatDescription()) ' If we need the Activity ID If lActivityID Then loInsertRow.ParameterAdd("ActivityID", loEventRecord.ActivityId.ToString) End If ' If we need the Bookmark If lBookmark Then loInsertRow.ParameterAdd("Bookmark", loEventRecord.Bookmark.ToString) End If ' If we need the Keywords If lKeyword Then loInsertRow.ParameterAdd("Keyword", loEventRecord.Keywords) End If ' If we need the Keywords display name If lKeywordDisplayName Then loInsertRow.ParameterAdd("KeywordDisplayName", loEventRecord.KeywordsDisplayNames.ToString) End If ' If we need the Level display name If lLevelDisplayName Then loInsertRow.ParameterAdd("LevelDisplayName", loEventRecord.LevelDisplayName) End If ' If we need the Computer If lComputer Then loInsertRow.ParameterAdd("Computer", loEventRecord.MachineName) End If ' If we need the Op code If lOpCode Then loInsertRow.ParameterAdd("OpCode", loEventRecord.Opcode) End If ' If we need the Op code display name If lOpCodeDisplayName Then loInsertRow.ParameterAdd("OpCodeDisplayName", loEventRecord.OpcodeDisplayName) End If ' If we need the Process ID If lProcessID Then loInsertRow.ParameterAdd("ProcessID", loEventRecord.ProcessId) End If ' If we need the Properties If lProperty Then loInsertRow.ParameterAdd("Property", loEventRecord.Properties.ToString) End If ' If we need the Provider ID If lProviderID Then loInsertRow.ParameterAdd("ProviderID", loEventRecord.ProviderId.ToString) End If ' If we need the Qualifiers If lQualifier Then loInsertRow.ParameterAdd("Qualifier", loEventRecord.Qualifiers) End If ' If we need the Record ID If lRecordID Then loInsertRow.ParameterAdd("RecordID", loEventRecord.RecordId) End If ' If we need the Related activity ID If lRelatedActivityID Then loInsertRow.ParameterAdd("RelatedActivityID", loEventRecord.RelatedActivityId.ToString) End If ' If we need the Task If lTask Then loInsertRow.ParameterAdd("Task", loEventRecord.Task) End If ' If we need the Task display name If lTaskDisplayName Then loInsertRow.ParameterAdd("TaskDisplayName", loEventRecord.TaskDisplayName) End If ' If we need the Thread ID If lThreadID Then loInsertRow.ParameterAdd("ThreadID", loEventRecord.ThreadId) End If ' If we need the Time created If lTimeCreated Then loInsertRow.ParameterAdd("TimeCreated", loEventRecord.TimeCreated) End If ' If we need the User If lUser Then ' If we have the object If Not loEventRecord.UserId Is Nothing Then loInsertRow.ParameterAdd("User", loEventRecord.UserId.ToString) End If End If ' If we need the Version If lVersion Then ' If we have the object If Not loEventRecord.Version Is Nothing Then loInsertRow.ParameterAdd("Version", loEventRecord.Version.ToString) End If End If If Not loInsertRow.InsertRow() Then Return False End If Else loRow = loData.oRows(0) ' Update the EventViewer record loUpdate.cTable = "EventViewer" loUpdate.nPrimaryKey = loRow("Numero") loUpdate.ParameterAdd("NoServer", nNoServer) loUpdate.ParameterAdd("NoEventViewerLog", nLog) loUpdate.ParameterAdd("NoEventViewerLevel", lnNoEventViewerLevel) loUpdate.ParameterAdd("ID", loEventRecord.Id) loUpdate.ParameterAdd("Source", loEventRecord.ProviderName) loUpdate.ParameterAdd("Description", loEventRecord.FormatDescription()) ' If we need the Activity ID If lActivityID Then loUpdate.ParameterAdd("ActivityID", loEventRecord.ActivityId.ToString) End If ' If we need the Bookmark If lBookmark Then loUpdate.ParameterAdd("Bookmark", loEventRecord.Bookmark.ToString) End If ' If we need the Keywords If lKeyword Then loUpdate.ParameterAdd("Keyword", loEventRecord.Keywords) End If ' If we need the Keywords display name If lKeywordDisplayName Then loUpdate.ParameterAdd("KeywordDisplayName", loEventRecord.KeywordsDisplayNames.ToString) End If ' If we need the Level display name If lLevelDisplayName Then loUpdate.ParameterAdd("LevelDisplayName", loEventRecord.LevelDisplayName) End If ' If we need the Computer If lComputer Then loUpdate.ParameterAdd("Computer", loEventRecord.MachineName) End If ' If we need the Op code If lOpCode Then loUpdate.ParameterAdd("OpCode", loEventRecord.Opcode) End If ' If we need the Op code display name If lOpCodeDisplayName Then loUpdate.ParameterAdd("OpCodeDisplayName", loEventRecord.OpcodeDisplayName) End If ' If we need the Process ID If lProcessID Then loUpdate.ParameterAdd("ProcessID", loEventRecord.ProcessId) End If ' If we need the Properties If lProperty Then loUpdate.ParameterAdd("Property", loEventRecord.Properties.ToString) End If ' If we need the Provider ID If lProviderID Then loUpdate.ParameterAdd("ProviderID", loEventRecord.ProviderId.ToString) End If ' If we need the Qualifiers If lQualifier Then loUpdate.ParameterAdd("Qualifier", loEventRecord.Qualifiers) End If ' If we need the Record ID If lRecordID Then loUpdate.ParameterAdd("RecordID", loEventRecord.RecordId) End If ' If we need the Related activity ID If lRelatedActivityID Then loUpdate.ParameterAdd("RelatedActivityID", loEventRecord.RelatedActivityId.ToString) End If ' If we need the Task If lTask Then loUpdate.ParameterAdd("Task", loEventRecord.Task) End If ' If we need the Task display name If lTaskDisplayName Then loUpdate.ParameterAdd("TaskDisplayName", loEventRecord.TaskDisplayName) End If ' If we need the Thread ID If lThreadID Then loUpdate.ParameterAdd("ThreadID", loEventRecord.ThreadId) End If ' If we need the Time created If lTimeCreated Then loUpdate.ParameterAdd("TimeCreated", loEventRecord.TimeCreated) End If ' If we need the User If lUser Then ' If we have the object If Not loEventRecord.UserId Is Nothing Then loUpdate.ParameterAdd("User", loEventRecord.UserId.ToString) End If End If ' If we need the Version If lVersion Then ' If we have the object If Not loEventRecord.Version Is Nothing Then loUpdate.ParameterAdd("Version", loEventRecord.Version.ToString) End If End If If Not loUpdate.Update() Then Return False End If End If Else ' Initialization loStringBuilder.Append("Event ID: " + loEventRecord.Id.ToString + oApp.cCR) loStringBuilder.Append("Publisher: " + loEventRecord.ProviderName + oApp.cCR) loStringBuilder.Append("Description: " + loEventRecord.FormatDescription() + oApp.cCR) ' If we need the Activity ID If lActivityID Then loStringBuilder.Append("Activity ID: " + loEventRecord.ActivityId.ToString + oApp.cCR) End If ' If we need the Bookmark If lBookmark Then loStringBuilder.Append("Bookmark: " + loEventRecord.Bookmark.ToString + oApp.cCR) End If ' If we need the Keywords If lKeyword Then loStringBuilder.Append("Keywords: " + loEventRecord.Keywords.ToString + oApp.cCR) End If ' If we need the Keywords display name If lKeywordDisplayName Then loStringBuilder.Append("Keywords display name: " + loEventRecord.KeywordsDisplayNames.ToString + oApp.cCR) End If ' If we need the Level If lLevel Then loStringBuilder.Append("Level: " + lnLevel.ToString + oApp.cCR) End If ' If we need the Level display name If lLevelDisplayName Then loStringBuilder.Append("Level display name: " + loEventRecord.LevelDisplayName + oApp.cCR) End If ' If we need the Computer If lComputer Then loStringBuilder.Append("Computer: " + loEventRecord.MachineName + oApp.cCR) End If ' If we need the Op code If lOpCode Then loStringBuilder.Append("Op code: " + loEventRecord.Opcode.ToString + oApp.cCR) End If ' If we need the Op code display name If lOpCodeDisplayName Then loStringBuilder.Append("Op code display name: " + loEventRecord.OpcodeDisplayName + oApp.cCR) End If ' If we need the Process ID If lProcessID Then loStringBuilder.Append("Process ID: " + loEventRecord.ProcessId.ToString + oApp.cCR) End If ' If we need the Properties If lProperty Then loStringBuilder.Append("Properties: " + loEventRecord.Properties.ToString + oApp.cCR) End If ' If we need the Provider ID If lProviderID Then loStringBuilder.Append("Provider ID: " + loEventRecord.ProviderId.ToString + oApp.cCR) End If ' If we need the Qualifiers If lQualifier Then loStringBuilder.Append("Qualifiers: " + loEventRecord.Qualifiers.ToString + oApp.cCR) End If ' If we need the Record ID If lRecordID Then loStringBuilder.Append("Record ID: " + loEventRecord.RecordId.ToString + oApp.cCR) End If ' If we need the Related activity ID If lRelatedActivityID Then loStringBuilder.Append("Related activity ID: " + loEventRecord.RelatedActivityId.ToString + oApp.cCR) End If ' If we need the Task If lTask Then loStringBuilder.Append("Task: " + loEventRecord.Task.ToString + oApp.cCR) End If ' If we need the Task display name If lTaskDisplayName Then loStringBuilder.Append("Task display name: " + loEventRecord.TaskDisplayName + oApp.cCR) End If ' If we need the Thread ID If lThreadID Then loStringBuilder.Append("Thread ID: " + loEventRecord.ThreadId.ToString + oApp.cCR) End If ' If we need the Time created If lTimeCreated Then loStringBuilder.Append("Time created: " + oApp.WritTime(loEventRecord.TimeCreated) + oApp.cCR) End If ' If we need the User If lUser Then ' If we have the object If Not loEventRecord.Version Is Nothing Then loStringBuilder.Append("User: " + loEventRecord.UserId.ToString + oApp.cCR) End If End If ' If we need the Version If lVersion Then ' If we have the object If Not loEventRecord.Version Is Nothing Then loStringBuilder.Append("Version: " + loEventRecord.Version.ToString + oApp.cCR) End If End If loStringBuilder.Append(oApp.cCR) End If loEventRecord = loEventLogReader.ReadEvent() End While llSuccess = True Exit For Next Catch loException As Exception ' If we log the error If lLogError Then ' Get the proper definition as per the current scope If oProcess Is Nothing Then oApp.ErrorSetup(loException) Else oProcess.ErrorSetup(loException) End If End If cMessage = loException.Message End Try ' Reset the values cDomain = "" cPassword = "" cServer = "" cUsername = "" lActivityID = True lAscending = True lBookmark = True lComputer = True lKeyword = True lKeywordDisplayName = True lLevel = True lLevelCritical = True lLevelDisplayName = True lLevelError = True lLevelInformation = False lLevelWarning = True lOpCode = True lOpCodeDisplayName = True lProcessID = True lProperty = True lProviderID = True lSource = True lQualifier = True lRecordID = True lRelatedActivityID = True lTask = True lTaskDisplayName = False lThreadID = True lTimeCreated = True lTransferToTable = False lUser = False lVersion = True nDelay = 250 nHour = 24 nNoServer = 0 nRecordID = 0 nRetry = 8 ' Initialization cResult = loStringBuilder.ToString cQuerystring = lcQueryString Return llSuccess End Function End Class