IT tutorials
 
Technology
 

Enabling Security Auditing on Windows Home Server (part 3) - Tracking Auditing Events

9/15/2013 7:30:15 PM
- Free product key for windows 10
- Free Product Key for Microsoft office 365
- Malwarebytes Premium 3.7.1 Serial Keys (LifeTime) 2019

3. Tracking Auditing Events

After you’ve enabled the security auditing policies that you want Windows Home Server to monitor, you can start tracking them to look for suspicious behavior. You do this using Windows Home Server’s Event Viewer. Unfortunately, the Security event log (which is where the auditing events appear) likely has tens of thousands of items. How do you look for suspicious behavior in such a large database?

Viewing Auditing Events with a Filter

The trick is to filter the log to show just the events you want. Here are the steps to follow:

1.
Log on to Windows Home Server.

2.
Select Start, Administrative Tools, Event Viewer. Windows Home Server opens the Event Viewer.

3.
Open the Windows Logs, Security branch.

4.
In the Actions pane, click Filter Current Log. Windows Home Server opens the Filter Current Log dialog box with the Filter tab displayed.

5.
In the Logged list, select the time frame you want to use, such as Last 24 Hours.

6.
In the Includes/Excludes Event IDs text box, type the event ID you want to find, if any. You can also enter a range (such as 4720–4782), or you can exclude an ID by preceding it with a minus sign.

7.
In the Keywords list, activate the check boxes for just the events you want to see (such as Audit Failure). Figure 8 shows a sample filter.

Figure 8. Use the Filter tab to specify exactly the events you want to see.

8.
Click OK. Event Viewer filters the Security log using your criteria. Figure 9 shows an example.



Figure 9. The results of the filter specifying Audit Failure shown in Figure 8.

Viewing Auditing Events with a Script

The only problem with filtering the Security log, as described in the previous section, is that you can’t filter based on detailed information such as the account logon error code. To do that, you need to use a script. Listing 1 presents a script that extracts just those Security events in which the type is Audit Failure and the error code is 0xC000006A (which represents an incorrect password).


Listing 1. A Script That Extracts Events from the Security Log
'
' Use WMI to extract events from the Security log where:
' - The type is "Audit Failure" (5)
' - The date is today
' - The error code points to an incorrect password (0xC000006A)
`
compName = "localhost"
Set objWMI = GetObject("winmgmts:{impersonationLevel=impersonate}!//" & _
compName & "\root\cimv2")
Set colSecLog = objWMI.ExecQuery("SELECT * FROM Win32_NTLogEvent Where " & _
"LogFile = 'Security' And " & _
"EventType = 5 And " & _
"TimeWritten > '" & TodaysDate & "' And " & _
"Message Like '%0xC000006A%'")
'
' Run through the returned events
'
i = 0
For Each objEvent in colSecLog
'
' Display the event data
'
WScript.Echo "Category: " & objEvent.CategoryString & VBCrLf & _
"Computer: " & objEvent.ComputerName & VBCrLf & _
"User: " & objEvent.User & VBCrLf & _
"Event Type: " & objEvent.Type & VBCrLf & _
"Event Code: " & objEvent.EventCode & VBCrLf & _
"Source Name: " & objEvent.SourceName & VBCrLf & _
"Time Written: " & ReturnLogDate(objEvent.TimeWritten) & _
VBCrLf & VBCrLf & _
"Message: " & VBCrLf & VBCrLf & objEvent.Message
i = i + 1
Next
'
' Check for no events
'
If i = 0 Then
WScript.Echo "No events found!"
End If
'
' Release objects
'
Set wmi = Nothing
Set secLog = Nothing
'
' This function creates a datatime string based on today's date
`
Function TodaysDate()
strYear = Year(Now)
If Month(Now) < 10 Then
strMonth = "0" & Month(Now)
Else
strMonth = Month(Now)
End If
If Day(Now) < 10 Then
strDay = "0" & Day(Now)
Else
strDay = Day(Now)
End If
TodaysDate = strYear & strMonth & strDay & "000000.000000-000"
End Function
'
' This function takes the event datetime value and converts
' it to a friendlier date and time format
'
Function ReturnLogDate(logTime)
eventYear = Left(logTime, 4)
eventMonth = Mid(logTime, 5, 2)
eventDay = Mid(logTime, 7, 2)
eventHour = Mid(logTime, 9, 2)
eventMinute = Mid(logTime, 11, 2)
eventSecond = Mid(logTime, 13, 2)
ReturnLogDate = DateSerial(eventYear, eventMonth, eventDay) & " " & _
TimeSerial(eventHour, eventMinute, eventSecond)
End Function


The script uses WMI to query the W32_NTLogEvent database, which consists of all the events on the system. The query extracts just those events in which the following is true:

  • The LogFile property equals Security.

  • The EventType property equals 5, which represents Audit Failure events.

  • The TimeWritten property contains only today’s date. The values in the TimeWritten property use the datetime data type, which uses the general format yyyymmddhhmmss.000000-000. So, the script uses the TodaysDate function to return a datetime value that corresponds to midnight today. The query actually looks for events that were written to the log after that time.

  • The Message property (which holds the error code, among other data) contains the error code 0xC000006A.

Then a For Each...Next loop runs through all the returned events. For each event, various event properties are displayed in a dialog box, as shown in Figure 10. The code calls the ReturnLogDate function to convert the TimeWritten property’s datetime value into a more readable format.

Figure 10. An example of the event data displayed by the script in Listing 11.1.

 
Others
 
- Enabling Security Auditing on Windows Home Server (part 2) - Understanding the Auditing Policies
- Enabling Security Auditing on Windows Home Server (part 1) - Activating the Auditing Policies
- Microsoft Exchange Server 2010 : Getting Help (part 2) - Learning from the Graphical User Interface
- Microsoft Exchange Server 2010 : Getting Help (part 1) - Help from the Command Line
- Microsoft Exchange Server 2010 : Managing Contacts (part 2)
- Microsoft Exchange Server 2010 : Managing Contacts (part 1) - Creating Mail-Enabled Contacts
- Microsoft Lync Server 2010 : Exchange 2010 and SharePoint 2010 Integration - Exchange 2010 Unified Messaging Architecture
- Microsoft Lync Server 2010 : Exchange 2010 and SharePoint 2010 Integration - Call Answering Rules
- Microsoft Lync Server 2010 : Exchange 2010 Unified Messaging
- BlackBerry Development : Pushing Data to Internal Users - Controlling Access to Push, Locating Internal Push Recipients
 
 
Top 10
 
- Microsoft Visio 2013 : Adding Structure to Your Diagrams - Finding containers and lists in Visio (part 2) - Wireframes,Legends
- Microsoft Visio 2013 : Adding Structure to Your Diagrams - Finding containers and lists in Visio (part 1) - Swimlanes
- Microsoft Visio 2013 : Adding Structure to Your Diagrams - Formatting and sizing lists
- Microsoft Visio 2013 : Adding Structure to Your Diagrams - Adding shapes to lists
- Microsoft Visio 2013 : Adding Structure to Your Diagrams - Sizing containers
- Microsoft Access 2010 : Control Properties and Why to Use Them (part 3) - The Other Properties of a Control
- Microsoft Access 2010 : Control Properties and Why to Use Them (part 2) - The Data Properties of a Control
- Microsoft Access 2010 : Control Properties and Why to Use Them (part 1) - The Format Properties of a Control
- Microsoft Access 2010 : Form Properties and Why Should You Use Them - Working with the Properties Window
- Microsoft Visio 2013 : Using the Organization Chart Wizard with new data
Technology FAQ
- Is possible to just to use a wireless router to extend wireless access to wireless access points?
- Ruby - Insert Struct to MySql
- how to find my Symantec pcAnywhere serial number
- About direct X / Open GL issue
- How to determine eclipse version?
- What SAN cert Exchange 2010 for UM, OA?
- How do I populate a SQL Express table from Excel file?
- code for express check out with Paypal.
- Problem with Templated User Control
- ShellExecute SW_HIDE
programming4us programming4us