By David Wiseman (Administrator)Created 08 Feb 2008
My Rating:
Not Rated

Copy Event Log Events to a Database

Language:  VBScript


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

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


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("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



Got a useful script? Click here to upload!


  Post Comment
Order By:  
User Comments
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?

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.

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.

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

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

street view for you walk, bike, or drive.

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.

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

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

United Kingdom
Posted On: 12/28/2019 4:34:06 AM

thanks for this informative post. If you are looking for assignment help online then Great Assignment Help is always ready to help their customers at affordable price. To gather more information, inbox us or browse our web pages at any time. assignment helper online assignment help assignment help online

Posted On: 1/12/2020 7:53:45 AM

Thanks for the sharing the informative post, Keep sharing it - Jobs in Balochistan

Andy Alvin
United Kingdom
Posted On: 1/17/2020 5:34:42 AM

Useful reading this post, samsung swot analysis Ford SWOT analysis

Andy Alvin
United Kingdom
Posted On: 1/17/2020 5:34:47 AM

Useful reading this post, samsung swot analysis Ford SWOT analysis

Posted On: 1/17/2020 5:55:47 AM

Thank u sir, for explaining so well the option explicit concept and I have learn something new.