Gatt Posted May 14, 2007 Posted May 14, 2007 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)
plexer Posted May 15, 2007 Posted May 15, 2007 http://linitx.com/product_info.php?cPath=128&products_id=909&osCsid=04dedc526dfa1d767ad06e09774e9e5e Looks cool. Ben
srochford Posted May 15, 2007 Posted May 15, 2007 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 :-) sub RecordLogon(sUsername,sComputername,sIP) dim sServer, sConn, oConn,oRS sServer="sqlservername" 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 end sub 1
maniac Posted May 23, 2007 Posted May 23, 2007 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?? Cheers, Mike.
mrcrazy04 Posted May 23, 2007 Posted May 23, 2007 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
Norphy Posted March 18, 2011 Posted March 18, 2011 Sorry to bump ye olde post but would you mind posting the logoff bit as well please Steve? Cheers
umass Posted September 23, 2011 Posted September 23, 2011 Hello, 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? Thanks 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
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now