Anyone know how to get a VBScript to connect to a SQL Server (2000 or 2005) ?
Looking for one to run during login & Logoff that will connect and be able to write info to a table on the sql server
Working on a logon/Logoff tracker that has a .NET interface (which is running - sort of)
We use this in a script to record username, computername and IP to a SQL database - call it with appropriate parameters :-)
The logoff does the same sort of thing but updates the last record for that user/computer pair - I can find the code if you need it :-)
dim sServer, sConn, oConn,oRS
sConn="provider=sqloledb;data source=" & sServer & ";initial catalog=logoninfo"
Set oConn = CreateObject("ADODB.Connection")
oConn.Open sConn, "username", "secretpassword"
Set oRS =CreateObject("ADODB.Recordset")
sSQL="insert into logonoff(username,compname,ip,ontime) values('" & sUserName & "','" & sComputerName & "','" & sIP & "',getdate())"
ors.open sSQL, oconn
Norphy (18th March 2011)
Cheers Steve - wil give that a bash on Wednesday
Just found this script very useful!
We're currently looking into ditching ranger and I'm looking for scripts that will replace some of the useful functions of ranger, such as finding out where a specific user has been logged on, which this script does perfectly for me! Now all I've got to do it write a simple PHP interface to allow me to search and report on the data!
I'm also looking for a script or another way of getting a live report on my screen of who is logged on and where at that moment in time. At the moment lan ranger does this of course, but is there another way of doing this without lan ranger??
I use an a VBScript (in an HTA) which uses WMI, and Active Directory for all the computer names (which it pings to see if they're on).
It's quite useful, as I definitely know who's on what machine when. I can also then log them off remotely
Sorry to bump ye olde post but would you mind posting the logoff bit as well please Steve?
I have a script that gives me some logon information (username, date and time at which they logged on), and I have a separate script that gives me the computer names. I am trying to merge those two scripts together, but I'm having a lot of trouble doing so. Would you be able to show me your code? Or if you want I can send you mine and you can give me some hints?
There are currently 1 users browsing this thread. (0 members and 1 guests)