Jump to content

Recommended Posts

Posted

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)

Posted

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

  • Thanks 1
Posted

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.

Posted

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

  • 3 years later...
  • 6 months later...
Posted

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

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



×
×
  • Create New...