Check which ports are open to the outside world. Helps make sure that your firewall rules are working as intended.
One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.
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
Join the community of 500,000 technology professionals and ask your questions.