+ Reply to Thread
Results 1 to 6 of 6

Thread: VBScript / SQL Server

  Share/Bookmark
  1. #1

    Reputation Reputation Reputation Reputation Reputation Reputation Reputation Reputation Reputation Reputation Reputation Reputation Reputation Reputation
    Gatt's Avatar
    Join Date
    Jan 2006
    Location
    Rochdale
    Posts
    4,113
    Thank Post
    434
    Thanked 218 Times in 159 Posts
    Rep Power
    98

    Default VBScript / SQL Server

    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)

  2. #2

    Reputation Reputation Reputation Reputation Reputation Reputation Reputation Reputation Reputation Reputation Reputation Reputation Reputation
    plexer's Avatar
    Join Date
    Dec 2005
    Location
    Norfolk
    Posts
    6,536
    Thank Post
    139
    Thanked 392 Times in 341 Posts
    Rep Power
    95

    Default Re: VBScript / SQL Server


  3. #3

    Reputation Reputation Reputation Reputation Reputation Reputation Reputation Reputation Reputation Reputation Reputation Reputation Reputation Reputation

    Join Date
    Aug 2005
    Location
    London
    Posts
    2,817
    Blog Entries
    2
    Thank Post
    75
    Thanked 444 Times in 390 Posts
    Rep Power
    98

    Default Re: VBScript / SQL Server

    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

  4. #4

    Reputation Reputation Reputation Reputation Reputation Reputation Reputation Reputation Reputation Reputation Reputation Reputation Reputation Reputation
    Gatt's Avatar
    Join Date
    Jan 2006
    Location
    Rochdale
    Posts
    4,113
    Thank Post
    434
    Thanked 218 Times in 159 Posts
    Rep Power
    98

    Default Re: VBScript / SQL Server

    Cheers Steve - wil give that a bash on Wednesday

  5. #5

    Reputation Reputation Reputation Reputation Reputation Reputation Reputation Reputation Reputation Reputation Reputation Reputation Reputation
    maniac's Avatar
    Join Date
    Feb 2007
    Location
    Kent
    Posts
    2,447
    Thank Post
    155
    Thanked 307 Times in 229 Posts
    Rep Power
    87

    Default Re: VBScript / SQL Server

    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.

  6. #6

    Reputation
    mrcrazy04's Avatar
    Join Date
    Nov 2006
    Location
    Bedfordshire/Dundee, UK
    Posts
    232
    Thank Post
    1
    Thanked 8 Times in 8 Posts
    Rep Power
    9

    Default Re: VBScript / SQL Server

    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

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

     

Similar Threads

  1. VBScript IDE + Debugger
    By Geoff in forum Scripts
    Replies: 4
    Last Post: 13-09-2007, 08:56 PM
  2. VBScript Error
    By sqdge in forum Scripts
    Replies: 20
    Last Post: 13-09-2007, 03:34 PM
  3. another VBScript question!
    By StewartKnight in forum Coding
    Replies: 4
    Last Post: 03-05-2007, 05:41 PM
  4. VBScript
    By StewartKnight in forum Coding
    Replies: 5
    Last Post: 01-05-2007, 11:04 AM
  5. vbscript arguements ?
    By mac_shinobi in forum Scripts
    Replies: 1
    Last Post: 20-02-2007, 10:29 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts