Felipe wrote:
> I'm looking for a way to get the version of each SQL Server instances
> installed locally on a server.
> Does anybody know the best way of doing that?
>
I use a VBScript program. You would need a connection string for each
instance.
===========
' Retrieve SQL Server version.
Option Explicit
Dim strConnect, adoConnection, adoRecordset, objShell
Dim strVersion, strLevel, strEdition
' Construct connection string for PocketLunch database.
strConnect = "DRIVER=SQL Server;" _
& "Trusted_Connection=Yes;" _
& "DATABASE=Master;" _
& "SERVER=MyServer\MyInstance"
' Create ADO objects and connect to PocketLunch database.
Set adoConnection = CreateObject("ADODB.Connection")
adoConnection.ConnectionString = strConnect
adoConnection.Open
Set adoRecordset = CreateObject("ADODB.Recordset")
Set adoRecordset.ActiveConnection = adoConnection
' Retrieve balances for each account as of specified date.
adoRecordset.Source = "SELECT SERVERPROPERTY('productversion') AS Version, "
_
& "SERVERPROPERTY('productlevel') AS Level, " _
& "SERVERPROPERTY('edition') AS Edition"
adoRecordset.Open
' Enumerate account balances.
Do Until adoRecordset.EOF
strVersion = adoRecordset.Fields("Version").Value
strLevel = adoRecordset.Fields("Level").Value
strEdition = adoRecordset.Fields("Edition").Value
Wscript.Echo "Version: " & strVersion
Wscript.Echo "Level: " & strLevel
Wscript.Echo "Edition: " & strEdition
adoRecordset.MoveNext
Loop
' Clean up.
adoRecordset.Close
adoConnection.Close
==========
Otherwise, you can run the query (the Source property of the ADO Recordset
object above) with a command line tool or GUI.
--
Richard Mueller
MVP Directory Services
Hilltop Lab -
http://www.rlmueller.net
--