Discussion:
Get SQL Server client version on remote server using VBScript
(too old to reply)
Highlander
2011-04-13 14:03:22 UTC
Permalink
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
Mayayana
2011-04-13 15:26:02 UTC
Permalink
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
Highlander
2011-04-13 16:05:20 UTC
Permalink
Post by Mayayana
The download here details the pros and cons of different
methods of getting installed software. Sample scripts
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.)
Mayayana - thanks for the reply. I cannot use your script however.


Anyone else?

- Dave
Mayayana
2011-04-13 17:00:43 UTC
Permalink
Post by Highlander
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.

Loading...