Get SQL Server client version on remote server using VBScript

Discussion in 'Scripting' started by Highlander, Apr 13, 2011.

  1. Highlander

    Highlander Guest

    Hello.

    I've got a few hundred Windows servers to check for which version of
    SQL Server client is installed. They have SQL Server client version
    2005, 2008, or both. I typically use a VBScript to check servers
    remotely for installed versions of programs, usually using the
    registry.

    I've done some checking and found out that I cannot use the registry
    to check for SQL, due to inconsistencies; and that using WMI is the
    preferred method.

    I've searched high and low and cannot find a WMI script which does
    this. Does anyone have a VBScript that uses WMI to get the SQL Server
    client version on a remote server?

    Any help would be greatly appreciated. Thanks!

    - Dave
     
    Highlander, Apr 13, 2011
    #1
    1. Advertisements

  2. Highlander

    Mayayana Guest

    The download here details the pros and cons of different
    methods of getting installed software. Sample scripts
    are included:

    http://www.jsware.net/jsware/scripts.php5#enumsoft

    I don't deal with remote PCs at all, but there is a WMI
    script in the download. You should be able to adapt that.

    (This assumes that SQL Server installs via MSI file. WMI
    cannot return installed software info. per se. It only sees
    MSI-installed software.)

    |
    | I've got a few hundred Windows servers to check for which version of
    | SQL Server client is installed. They have SQL Server client version
    | 2005, 2008, or both. I typically use a VBScript to check servers
    | remotely for installed versions of programs, usually using the
    | registry.
    |
    | I've done some checking and found out that I cannot use the registry
    | to check for SQL, due to inconsistencies; and that using WMI is the
    | preferred method.
    |
    | I've searched high and low and cannot find a WMI script which does
    | this. Does anyone have a VBScript that uses WMI to get the SQL Server
    | client version on a remote server?
    |
    | Any help would be greatly appreciated. Thanks!
    |
    | - Dave
     
    Mayayana, Apr 13, 2011
    #2
    1. Advertisements

  3. Highlander

    Highlander Guest

    Mayayana - thanks for the reply. I cannot use your script however.


    Anyone else?

    - Dave
     
    Highlander, Apr 13, 2011
    #3
  4. Highlander

    Mayayana Guest

    Mayayana - thanks for the reply. I cannot use your script however.

    Sorry, I was thinking of the Windows Installer code.
    I didn't realize that I hadn't actually included a WMI
    script. (WMI wraps Windows Installer, so for someone
    not dealing with a network WMI is irrelevant.)

    I think you can use the following. Again, I'm not
    familiar with remote operations, but I think you
    just have to change the GetObject parameter.

    Dim WMI, Col, Prod
    Set WMI = GetObject("WinMgmts:")
    Set Col = WMI.InstancesOf("Win32_Product")
    For Each Prod in Col
    MsgBox Prod.name & vbCrLf & Prod.vendor & vbCrLf & Prod.version
    Next
    Set Col = Nothing
    Set WMI = Nothing

    Alternatively, you can set up a query:

    Dim WMI, Col, Prod
    Set WMI = GetObject("WinMgmts:")
    Set Col = WMI.ExecQuery("Select * FROM Win32_Product WHERE Vendor =
    'Microsoft Corporation'")
    For Each Prod in Col
    MsgBox Prod.name & vbCrLf & Prod.vendor & vbCrLf & Prod.version
    Next
    Set Col = Nothing
    Set WMI = Nothing

    See Win32_Product for more details about its properties.
     
    Mayayana, Apr 13, 2011
    #4
    1. Advertisements

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments (here). After that, you can post your question and our members will help you out.