Improve and reinforce salesforce training & adoption using WalkMe's digital adoption platform. Start saving on costly employee training by creating fast intuitive Walk-Thrus for Salesforce. Claim your Free Account Now
Imports System.Threading Imports System.Net.Mail Imports System.Security.Principal Public Class EventLogWatcherService Private Shared signal As AutoResetEvent Protected Overrides Sub OnStart(ByVal args() As String) ' This is where the service starts 'Start the Event Log Watcher Service as a new thread Dim workerThread = New Thread(AddressOf WatchEventLog) workerThread.Start() 'Write start message to Eventlog WriteLogMessage("Service Started", EventLogEntryType.Information) End Sub Public Sub WatchEventLog() 'Set new event signal = New AutoResetEvent(False) 'Connect to the OS-Security Eventlog Dim logwatcherlog = New EventLog("Security", ".", "LogMonitoringService") logwatcherlog.Source = "LogMonitoringService" 'Add event handler to the Security Eventlog. This triggers at new events AddHandler logwatcherlog.EntryWritten, New System.Diagnostics.EntryWrittenEventHandler(AddressOf EventLog1_EntryWritten) logwatcherlog.EnableRaisingEvents = True 'Wait for Event signal.WaitOne() End Sub Public Sub EventLog1_EntryWritten(ByVal [source] As Object, ByVal e As entryWrittenEventArgs) 'Check the Events on EventID's. On match a new thread is fired to handle this event. If e.Entry.InstanceId = "4728" Or e.Entry.InstanceId = "4729" Then Dim thread As New Threading.Thread(AddressOf FoundEventToHandle) thread.Start(e) End If End Sub Public Sub FoundEventToHandle(ByVal e As EntryWrittenEventArgs) ‘Filters the eventmessage and sends an email on a filter match. '** WHEN HR-->AD IMPORT IS RUN, THIS PART ISN"T REACHED** 'Dispose the current Entry to prevent unresponive service e.Entry.Dispose() 'Sleep short and Signal for complete Thread.Sleep(1) signal.Set() End Sub
Add your voice to the tech community where 5M+ people just like you are talking about what matters.
|vb.net dbnull syntax||1||59|
|What are MicroServices?||4||69|
|Help solve error message when converting date using vb.NET||10||44|
|VB.NET : Selection Out of Range Parameter Name : Value||22||37|
Join the community of 500,000 technology professionals and ask your questions.