Read this Gartner Research Note and discover how your IT organization can automate and optimize DevOps processes using a toolchain architecture.
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
|Trying to get PDF to open as "Open,Save,Cancel" instead of as a pop-up.||6||31|
|Resolve Dependency Issues||4||44|
|scanning dentists xray (the small ones)||3||43|
|Handle KeyDown for ToolStripDropDownButton, ToolStripMenuItem||3||21|
Join the community of 500,000 technology professionals and ask your questions.
Connect with top rated Experts
18 Experts available now in Live!