By David Wiseman (Administrator)Created 08 Feb 2008
My Rating:
Vote
Rating:
Not Rated
Views:10512
Downloads:116

Copy Event Log Events to a Database

Language:  VBScript

Compatibility

Windows XP Yes Windows 2003 Yes
Windows 2000 Yes Windows NT Yes
Vista Unknown Windows 2008 Unknown
Description

Retrieves events from all the event logs and records these in a database with the DSN Name of EventLogs.

Code

Line Numbers: On  Off      Plain Text
Set objConn = CreateObject("ADODB.Connection")
Set objRS = CreateObject("ADODB.Recordset")

objConn.Open "DSN=EventLogs;"
objRS.CursorLocation = 3
objRS.Open "SELECT * FROM EventTable" , objConn, 3, 3
strComputer = "."

Set objWMIService = GetObject("winmgmts:" _
    & "{impersonationLevel=impersonate}!\\" & strComputer & "\root\cimv2")

Set colRetrievedEvents = objWMIService.ExecQuery _
    ("Select * from Win32_NTLogEvent")

For Each objEvent in colRetrievedEvents
    objRS.AddNew
    objRS("Category") = objEvent.Category
    objRS("ComputerName") = objEvent.ComputerName
    objRS("EventCode") = objEvent.EventCode
    objRS("Message") = objEvent.Message
    objRS("RecordNumber") = objEvent.RecordNumber
    objRS("SourceName") = objEvent.SourceName
    objRS("TimeWritten") = objEvent.TimeWritten
    objRS("Type") = objEvent.Type
    objRS("User") = objEvent.User
    objRS.Update
Next

objRS.Close
objConn.Close

 


Got a useful script? Click here to upload!


 

  Post Comment
Order By:  
User Comments
      
John
United States
Posted On: 4/16/2009 9:04:22 AM

I assume thast the strComputer can be any name? As if i want to copy a specific System event from a network computer into the database, i would just change the "." to the specified name?

MartaSmith
Posted On: 7/16/2019 10:02:53 AM

Your given script is very simple to follow through which I can easily update active directory user attributes from any kind of a CSV file. Visit help with assignment for more info. Updating active directory uses attributes was never so easy for me.

AnthonyAnson
Posted On: 8/8/2019 10:32:04 AM

Your script is very updated about the new version of the database and peoples easily to work on this. Those organization is working in this field now they have a good thing for taking the unique information. Our online assignment writing service is also working in the database program and we also take a useful lesson.

daisy thomas
United Kingdom
Posted On: 8/24/2019 5:36:57 AM [Edited 8/24/2019 5:37:35 AM]

Thanks for sharing this script. it's very useful and simple to use. students assignment help have Java assignment help Experts that give suggestion on your script.

jessaminezara
Posted On: 9/17/2019 8:25:35 AM

So when you are speaking about applying data base update scripts and the most obvious solution are to usage the application property best assignment writing service. When the application is organized and has data base scripts involved that are not yet applied to the database, the server will perform the scripts and mark the scripts as applied, so that afterward time the scripts will not be realistic again

tararubena
Posted On: 9/26/2019 5:00:19 AM

street view for you walk, bike, or drive.

RoxieShoulders
Posted On: 10/17/2019 6:46:21 AM

For the organization or the company data is everything and if any of the data lost it means that profit of the company lost and now I'm satisfied by getting EduBirdy services for the compilation of task. In this situation, the company needs such software that fully completes the requirement. The oracle database software is very good software but needs improvement.

johnsmith123
Posted On: 10/22/2019 10:34:09 AM

Thanks for updating us but can you please tell me how can i create object in my database? Thanks Dissertation writing services

Brown34566
Posted On: 11/1/2019 4:39:29 AM



Posted On: 11/15/2019 9:47:59 AM

Your feedback helps me a lot, A very meaningful event, I hope everything will go well basketball legends