Trying to connect to SQL server

Tech-Archive recommends: Repair Windows Errors & Optimize Windows Performance



Hi,

I'm trying to use the script below to copy the event logs from our servers
to a SQL database, but when I run the script it's trying to connect as null.
How can I have it connect with a user and password the SQL server will
accept. Thanks for any help

On Error Resume Next

Set objOU = GetObject("LDAP://OU=Finance,dc=fabrikam,dc=com";
objOU.Filter = Array("Computer")

For Each objComputer in objOU
strComputer = objComputer.CN

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

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
.



Relevant Pages

  • Re: Deny rules...
    ... services client I have not implemented it. ... Tony Su ... >The Script makes sure the ip to be blocked is not itīs ... >I have few outside servers to connect from to my servers ...
    (microsoft.public.isa)
  • Re: Software configuration management tool required
    ... If it automates ... and 100-ish servers, it's just not going to happen. ... you test it by running the rc?.d script that init will ... > because Oracle or some vendor tells them to do so. ...
    (comp.unix.admin)
  • Re: trouble with a script
    ... Your snippet of code doesn't look like sh on FreeBSD. ... Basically, I want my script to prompt me for two inputs, then append to ... The user input would be "domain.com", ... is how we set up a client's site on our servers. ...
    (comp.unix.shell)
  • Re: trouble with a script
    ... Your snippet of code doesn't look like sh on FreeBSD. ... Basically, I want my script to prompt me for two inputs, then append to ... The user input would be "domain.com", ... is how we set up a client's site on our servers. ...
    (comp.unix.shell)
  • Re: login script failing?
    ... Well if all DCs are in same site/local lan, and only some mappings ... If you manually run that script after user logs on does the mapping occur? ... How do you know whch servers are the users logging on? ... relevant servers but no matter what I put in the login script, ...
    (microsoft.public.windows.server.active_directory)