PDA

View Full Version : Need advice: Detecting if ASP is disabled on IIS 6.0



mikeyfev1
11-30-2004, 11:32 AM
Need advice on how to handle a situation on install. Our product will not function correctly if the computer has ASP support disabled. This setup can exist on an IIS 6.0 webserver. Therefore we want to detect if this setup is present and refuse to install until the user corrects the setup.

It appears that InstallShield does not have a clean way to detect this situation (please correct me if I am wrong), so I went to the Microsoft support site and found a couple of articles describing how to write a script utilizing ADSI to check on IIS.

I thought I would simply take this script, modify it to run in a custom action environment and have this problem solved. NOT! A custom action script can apparently only return OK as a status. So I thought I would use a MsiSetProperty call in the script to communicate back to the install; but I don't think that the Msi... interfaces are directly exposed to custom action scripts (Are they? If so how do I reference them?).

I can't use a simple InstallScript function because the ASDI object returns a VB safe array. I don't know how to utilize a VB safe array in InstallScript...is there a way to do that?

Even more basic, is there a way to determine if my custom action script is even executing? I tried embedding console output, Popup windows, a debugger call and even the creation of a dummy marker file. All to no avail.

I know there are people who firmly recommend against using any type of script in a custom action, but this seems very straightforward..."seems" of course being the operative phrase here.

Am I just going at this all wrong? Any advice appreciated.

BTW: Here's the custom action script so you can see how MS intends a script to detect the situation:

*********************************************************
function IsASPEnabled (hMSI)
{
SetASPEnabled ();
var IDOK = 1;

try
{
// Connect to the computer's ADSI interface for IIS.

var oIIsWebService = GetObject ("IIS://localhost/W3SVC");

// Get the WebSvcExtRestrictionList.

var aWebSvcExtRestrictionList = new Array ();
aWebSvcExtRestrictionList = oIIsWebService.WebSvcExtRestrictionList;
var vbaTemp = new VBArray (aWebSvcExtRestrictionList);
var aList = new Array ();
aList = vbaTemp.toArray ();
}
catch (e)
{
return IDOK;
}

// If the list has zero length then most likely the computer was not
// running IIS 6.0 or higher. The WebSvcExtRestrictionList was not
// available on IIS pre-6.0.

if (aList.length == 0)
return IDOK;

for (var i = 0; i < aList.length; i++)
{
var aTemp = new Array ();
aTemp = aList[i].split (/,/);

// I found a hint that this value could be something *other* than
// 0 or 1.
// So check for 1 and use that for enabled; all other values are
// disabled.

var bAllow = (aTemp[0] == 1) ? true : false;
var sExtPath = aTemp[1];
var oMatch = sExtPath.match (/asp.dll^/i);
if (oMatch != null)
{
if (bAllow)
{
return IDOK;
}
else
{
SetASPDisabled ();
return 0;
}
}
}
return IDOK;

function SetASPEnabled ()
{
MsiSetProperty (hMSI, "NV_IsASPEnabled", "1");
}

function SetASPDisabled ()
{
MsiSetProperty (hMSI, "NV_IsASPEnabled", "0");
}
}

arik__y
12-20-2004, 07:45 AM
First of all you need to check if the Service Exists (even if the iis is not of type 6
The administrator can remove the iis from the add remove program in win 2000)
You can use the function ServiceExistsService (install script project function )

So you need to check the existent of the IISADMIN And the w3svc
And only in 2003 server you need to see if the asp component is install
You can do that be look for this key in the registry
SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Setup\\OC Manager\\Subcomponents

You can read more in this site
http://www.microsoft.com/technet/prodtechnol/windowsserver2003/technologies/security/ws03mngd/13_s3iis.mspx


hope that helps