SSAS: Detecting the version of SSAS on a given server

To detect the version of AS, use ADOMD and connect using a connection string like "Provider=MSOLAP;Data Source=<server>;" where <server> is the name of your server. If you have the 2000 and 2005 providers on your system, the 2005 provider will attempt to connect to first and will then fall through to using the 2000 (v8) provider if the server is an AS2000 server. Once you have an open ADOMD connection you can check the value of the ServerVersion property of the connection. A value with a major version of 8 is AS2000, 9 is 2005.

In VB.Net something roughly like the following would print the server version to the debug window. (I tested this concept in Powershell and have translated to VB.Net on the fly, so I hope I have not made any typing mistakes)

Dim oCon as AdomdConnection = New AdomdConnection
oCon.ConnectionString = "Provider=MSOLAP;Data Source=localhost"

Here is the original Powershell script:

[System.Reflection.Assembly]::LoadWithPartialName("Microsoft.AnalysisServices.AdomdClient") > $null
$connObj = new-object 
$connObj.ConnectionString = "Data Source=localhost\sql05"

On my laptop it currently gives me an output of "9.00.3054.00", the 9 at the front indicates that this is a SQL 2005 instance. Changing the "Data Source" setting from "localhost\sql05" to "localhost" changes this code from running against my named AS2k5 server, to running against my AS2K server and returns a value of "8.00.2039".


Print | posted on Saturday, July 14, 2007 8:08 PM

Comments on this post

No comments posted yet.

Your comment:

 (will show your gravatar)