Jump to content

problems with vb-script to retrieve eventlogs and write it into an mdb


Recommended Posts

Hello,

can anyone help me to work on the script below ? it came the errormessage:

Zeile: 20

Zeichen: 5

Fehler: Fehler bei einem aus mehreren Schritten bestehenden Vorgang. Prüfen Sie die einzelnen Statuswerte

Code: 80040E21

Quelle: Microsoft Cursor Engine

and thats the vb script:

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

where is the error ? i dont knew....

thanks

/kr

Melnib00ne

Link to comment
Share on other sites


Hi,

thanks for answer. Yes, i'am sure, thats the same script. I have an dsn to the access database, the table in the access database is the same... i copy and paste the script from microsoft also in an new script, but the errormessage was the same..... any ideas ?

/kr

Melniboone

Link to comment
Share on other sites

doubl check the field types for each of the fields you are entering, it is failing on the update so you are looking at a possible incorrect type mismatch, or that one of the properties is not support, for the DSn are you using OLE? Access?

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...