Re: Get SQL Server version of each instance installed



I looked for a way to enumerate all instances, but the only solution I found
used .NET. There must be an SQL query (when you connect to the default
instance) to do this, but I could not find it. One way would be to run "net
start" and parse everything that starts with MSSQL$ for instance names,
except under newer versions of SQL the service seems to be named:

SQL Server (<instance name>)

--
Richard Mueller
MVP Directory Services
Hilltop Lab - http://www.rlmueller.net
--

"Carlos Felipe França da Fonseca" <carlosfelipefranca@xxxxxxxxx> wrote in
message news:OqiA6rbGJHA.2468@xxxxxxxxxxxxxxxxxxxxxxx
Thanks for your reply, Richard.

I'm going to run this solution on many servers, locally and monthly using
Tivoli monitoring. The reason of running that is for auditing purposes.
The problem is that I don't know how many instances each server is
running.
So, we'll need to discover how many instances the server is running and
also
their respective versions.
We'll confirm if all licences for all instances are available and if each
server really has the number of instances mentioned in the support
contract.

Thanks again,

Felipe

"Richard Mueller [MVP]" <rlmueller-nospam@xxxxxxxxxxxxxxxxxxxx> wrote in
message news:ObEOzHbGJHA.4760@xxxxxxxxxxxxxxxxxxxxxxx
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
--






.



Relevant Pages

  • RE: Fulltext failure on a 2 node cluster
    ... Server full-text search resource online: "SQL Cluster Resource 'Full Text' ...
    (microsoft.public.sqlserver.clustering)
  • Re: HELP PLEASE ~ ???
    ... You mentioned that it went ahead and added a SQL ... SQL Server 2000 database for all my data. ... find the connectionString in the newly recreated SQLExpress database. ... The connection string specifies a local Sql Server Express instance ...
    (microsoft.public.dotnet.framework.aspnet)
  • Re: Multi-Channel Raid VS SAN Storage
    ... A 5~6 years old server is a very old server. ... As I mentioned, the server is one node in a cluster environment, and SQL is ... We actually are running RAID 1+0 and our aplication is definately more ... needs it's own SAN device, or at least a dedicated IO channel on the SAN. ...
    (microsoft.public.sqlserver.setup)
  • RE: How do I get back to base SQL server on my SBS 2003 server?
    ... After you uninstall SQL 2005, the instance which you upgraded will not go ... Uninstall and then reinstall ISA server. ... Uninstall and then reinstall the Monitoring component. ... Tools to Maintenance, change Monitoring component to Install, and then ...
    (microsoft.public.windows.server.sbs)
  • Re: Multi-Channel Raid VS SAN Storage
    ... A 5~6 years old server is a very old server. ... As I mentioned, the server is one node in a cluster environment, and SQL is ... We actually are running RAID 1+0 and our aplication is definately more ... needs it's own SAN device, or at least a dedicated IO channel on the SAN. ...
    (microsoft.public.sqlserver.setup)