cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
grparsec
Level 7

How to detect SQL Server Reporting Services during the setup

I am working on a Basic MSI project. One of the features in my setup needs Reporting Services (2005 or 2008) to operate. I would like to be able to detect the installation of SSRS during my setup and show a warning/error if it was not instlled.
Your help is appriciated.
Labels (1)
0 Kudos
(3) Replies
mikewiz
Level 4

Here is a function I use

function CheckPrerequisites(hMSI)
begin
PREREQUISITE_MISSING = FALSE; //if its missing at least one, it will be set to true in the sub function

PREREQ_NAME = "Microsoft SQL Server 2005 Reporting Services or greater";
REGISTRY_KEY = "SOFTWARE\\Microsoft\\Microsoft SQL Server\\Reporting Services";
REGISTRY_KEY_FIELD = "Version";
REGISTRY_KEY_VALUE_TO_CHECKFOR = "9.00.3042.00";

TestIfRegKeyFieldExistsAndHasASpecificValueOrGreater(hMSI);
end;


function TestIfRegKeyFieldExistsAndHasASpecificValueOrGreater(hMSI)
STRING szKey, szFieldName, szValue, svFieldValue_output;
STRING svFieldExpectedValue, strPrereqName;
NUMBER nType, nSize, nvType, nvFieldSize_output;
begin

szKey = REGISTRY_KEY;
szFieldName = REGISTRY_KEY_FIELD;
svFieldExpectedValue = REGISTRY_KEY_VALUE_TO_CHECKFOR;
strPrereqName = PREREQ_NAME;

RegDBSetDefaultRoot(HKEY_LOCAL_MACHINE);

//Check to see if the key exists.
if (RegDBKeyExist (szKey) < 0) then
PREREQUISITE_MISSING = TRUE;
MsiSetProperty(hMSI, "PREREQS_MISSING", "1");
ListAddString(LIST_OF_MISSING_PREREQS, strPrereqName, AFTER);
else
// Retrieve key value information.
if (RegDBGetKeyValueEx(szKey, szFieldName, nvType, svFieldValue_output, nvFieldSize_output) < 0) then
PREREQUISITE_MISSING = TRUE;
MsiSetProperty(hMSI, "PREREQS_MISSING", "1");
ListAddString(LIST_OF_MISSING_PREREQS, strPrereqName, AFTER);
else
if (svFieldValue_output >= svFieldExpectedValue) then
ListAddString(LIST_OF_EXISTING_PREREQS, strPrereqName, AFTER);
else
PREREQUISITE_MISSING = TRUE;
MsiSetProperty(hMSI, "PREREQS_MISSING", "1");
ListAddString(LIST_OF_MISSING_PREREQS, strPrereqName, AFTER);
endif;
endif;
endif;
end;
0 Kudos
grparsec
Level 7

Thank you for your reply Mike Wiz. Unfortunately I am not familiar with InstallScript. I want my setup to show an error after the user selected a certain feature that needs Reporting Services if it was not installed. I am not sure how to use the above script to accomplish this.
0 Kudos
operaza
Level 4

As an alternative to Mike's advice you can also check for the URL of the reporting services web service availability with a simple vbscript, a lot of time the SSRS is in a different computer. And a lot of times you are developing reports deployment tools instead of real installers so checking for the URL works also.
On Error Resume Next
URL = WScript.Arguments(0)
Set oXMLHTTP = CreateObject("MSXML2.XMLHTTP.6.0")
oXMLHTTP.open "GET", URL, false
oXMLHTTP.send
Result="URLNotFound"
If oXMLHTTP.status = 200 Then
Result="URLFound"
End If
wscript.echo Result
0 Kudos