Partilhar via


HOWTO: Programmatically detect status of a Web Service Extension

The following question was posted to the microsoft.public.inetserver.iis newsgroup on the msnews.microsoft.com NNTP server:

Question:

From an application install point of view I am interested to know a mechanism to programmatcially check if a particular web service extension is enabled or not on IIS 6.0

I read the following article https://www.microsoft.com/technet/prodtechnol/windowsserver2003/technologies/security/ws03mngd/13_s3iis.mspx but am not quite sure if this is the way to go.

Moreover, when the ASP extension is allowed the registry key value for iis_asp still reads 0.

thanks.

Answer:

Actually, there are two independent concepts here:

  1. Are the files of a component installed on the machine or not
  2. Is the component enabled for execution by IIS

All four cross-products are valid. In other words:

  1. Files of the component are not installed, and the component is not enabled - the component just doesn't work
  2. Files of the component are not installed, and the component is enabled - the component will function as soon as it gets installed
  3. Files of the component are installed, and the component is not enabled - the component will function as soon as you enable it
  4. Files of the component are installed, and the component is enabled - the component should be functioning

So, it all depends on which situation you want to detect.

The registry keys mentioned in your referenced URL actually record whether the user selected the checkbox in Add/Remove Programs. Unfortunately, the registry value has nothing to do with whether files are actually installed/not-installed. Its meaning is completely up to the component itself.

In the case of iis_asp, the checkbox is actually used to toggle enable/disable the ASP Web Service Extension and is pretty useless for determining whether the ASP component is enabled or not. This is because the registry value only records the last time the user ran Add/Remove Programs whether they selected to enable ASP or not. Since you can change that Web Service Extension value from the UI or with programmatically with tools like iisext.vbs, the registry value has no bearing on reality and should be ignored.

iisext.vbs has code that illustrates how to determine if a component is enabled or not.

https://msdn.microsoft.com/library/default.asp?url=/library/en-us/iissdk/html/5e7f8cde-4a01-42bd-acaf-f8f7d091ef7c.asp

//David