How to detect which IIS 7 components are enabled?

How to detect which IIS 7 components are enabled?

am 18.10.2007 21:11:02 von melvers

I am looking for a way to determine programmatically, using C#, which IIS 7
components are currently enabled (not just installed). I have tried looking
at various registry keys that I have found on the Internet but none of them
seem to accurately reflect the current settings for which IIS 7 components
are enabled.

Re: How to detect which IIS 7 components are enabled?

am 18.10.2007 21:45:03 von David Wang

On Oct 18, 12:11 pm, melvers
wrote:
> I am looking for a way to determine programmatically, using C#, which IIS 7
> components are currently enabled (not just installed). I have tried looking
> at various registry keys that I have found on the Internet but none of them
> seem to accurately reflect the current settings for which IIS 7 components
> are enabled.


First, let me make sure I understand your terminology.

When you say "installed" you mean "presence/absence of specific DLLs
of IIS7 Modules on the server machine" and "enabled" you mean "allowed
by IIS7 to execute on a given request".

If the above is correct, then the state of "enablement" has never been
in Registry keys (that's a hack for state of IIS7 module
"installation") -- the enablement list is the merged list
for a given URL. It is located inside of applicationHost.config by
default, and further modified by child web.config files as permitted.

Thus, you need to know the exact URL to determine the list of enabled
IIS7 components for that URL ONLY. It can be different for another
URL.

Currently, there is no managed code API for you to determine the
merged list. It will be coming in Windows Server 2008 and
should be available with Vista SP1 as well.

If you need to do this now, the APPCMD.EXE tool and the nativerd.h C-
include file will be the best and only way.


//David
http://w3-4u.blogspot.com
http://blogs.msdn.com/David.Wang
//

Re: How to detect which IIS 7 components are enabled?

am 18.10.2007 22:16:03 von melvers

Thanks. You may see me in your blog as well. I will clarify what I am
trying to detect. I want to programatically (using C#) determine which boxes
were checked under the Internet Information Services item in the Turn Windows
features on or off UI.

"David Wang" wrote:

> On Oct 18, 12:11 pm, melvers
> wrote:
> > I am looking for a way to determine programmatically, using C#, which IIS 7
> > components are currently enabled (not just installed). I have tried looking
> > at various registry keys that I have found on the Internet but none of them
> > seem to accurately reflect the current settings for which IIS 7 components
> > are enabled.
>
>
> First, let me make sure I understand your terminology.
>
> When you say "installed" you mean "presence/absence of specific DLLs
> of IIS7 Modules on the server machine" and "enabled" you mean "allowed
> by IIS7 to execute on a given request".
>
> If the above is correct, then the state of "enablement" has never been
> in Registry keys (that's a hack for state of IIS7 module
> "installation") -- the enablement list is the merged list
> for a given URL. It is located inside of applicationHost.config by
> default, and further modified by child web.config files as permitted.
>
> Thus, you need to know the exact URL to determine the list of enabled
> IIS7 components for that URL ONLY. It can be different for another
> URL.
>
> Currently, there is no managed code API for you to determine the
> merged list. It will be coming in Windows Server 2008 and
> should be available with Vista SP1 as well.
>
> If you need to do this now, the APPCMD.EXE tool and the nativerd.h C-
> include file will be the best and only way.
>
>
> //David
> http://w3-4u.blogspot.com
> http://blogs.msdn.com/David.Wang
> //
>
>

Re: How to detect which IIS 7 components are enabled?

am 19.10.2007 02:41:46 von David Wang

On Oct 18, 1:16 pm, melvers wrote:
> Thanks. You may see me in your blog as well. I will clarify what I am
> trying to detect. I want to programatically (using C#) determine which boxes
> were checked under the Internet Information Services item in the Turn Windows
> features on or off UI.
>
>
>
> "David Wang" wrote:
> > On Oct 18, 12:11 pm, melvers
> > wrote:
> > > I am looking for a way to determine programmatically, using C#, which IIS 7
> > > components are currently enabled (not just installed). I have tried looking
> > > at various registry keys that I have found on the Internet but none of them
> > > seem to accurately reflect the current settings for which IIS 7 components
> > > are enabled.
>
> > First, let me make sure I understand your terminology.
>
> > When you say "installed" you mean "presence/absence of specific DLLs
> > of IIS7 Modules on the server machine" and "enabled" you mean "allowed
> > by IIS7 to execute on a given request".
>
> > If the above is correct, then the state of "enablement" has never been
> > in Registry keys (that's a hack for state of IIS7 module
> > "installation") -- the enablement list is the merged list
> > for a given URL. It is located inside of applicationHost.config by
> > default, and further modified by child web.config files as permitted.
>
> > Thus, you need to know the exact URL to determine the list of enabled
> > IIS7 components for that URL ONLY. It can be different for another
> > URL.
>
> > Currently, there is no managed code API for you to determine the
> > merged list. It will be coming in Windows Server 2008 and
> > should be available with Vista SP1 as well.
>
> > If you need to do this now, the APPCMD.EXE tool and the nativerd.h C-
> > include file will be the best and only way.
>
> > //David
> >http://w3-4u.blogspot.com
> >http://blogs.msdn.com/David.Wang
> > //- Hide quoted text -
>
> - Show quoted text -


Ok, you want "presence/absence of specific DLLs of IIS7 Modules which
are installed when the checkbox is checked."

I don't know of an API to retrieve it (that's public, anyway) for
Vista. There's a commandline tool for Windows Server 2008 that would
query the installation state, which is only slightly better than the
Registry hack.

In the end, from a pre-requisite checking perspective, you have to
decide if the registry key, CBS state, DLL existence, or feature is
functional is the pre-requisite that you want. Why? Because you know
it is possible to have registry key or CBS state to say one thing when
reality is another, and DLL can be present but not enabled/functional.
What level of detection is sufficient?


//David
http://w3-4u.blogspot.com
http://blogs.msdn.com/David.Wang
//

Re: How to detect which IIS 7 components are enabled?

am 19.10.2007 14:55:03 von melvers

I am trying to detect it required IIS components are present (and assumed
operational) during a software install so I can provide the user with a
notification that they need to enable/install the IIS components before the
software will fully function.

"David Wang" wrote:

> On Oct 18, 1:16 pm, melvers wrote:
> > Thanks. You may see me in your blog as well. I will clarify what I am
> > trying to detect. I want to programatically (using C#) determine which boxes
> > were checked under the Internet Information Services item in the Turn Windows
> > features on or off UI.
> >
> >
> >
> > "David Wang" wrote:
> > > On Oct 18, 12:11 pm, melvers
> > > wrote:
> > > > I am looking for a way to determine programmatically, using C#, which IIS 7
> > > > components are currently enabled (not just installed). I have tried looking
> > > > at various registry keys that I have found on the Internet but none of them
> > > > seem to accurately reflect the current settings for which IIS 7 components
> > > > are enabled.
> >
> > > First, let me make sure I understand your terminology.
> >
> > > When you say "installed" you mean "presence/absence of specific DLLs
> > > of IIS7 Modules on the server machine" and "enabled" you mean "allowed
> > > by IIS7 to execute on a given request".
> >
> > > If the above is correct, then the state of "enablement" has never been
> > > in Registry keys (that's a hack for state of IIS7 module
> > > "installation") -- the enablement list is the merged list
> > > for a given URL. It is located inside of applicationHost.config by
> > > default, and further modified by child web.config files as permitted.
> >
> > > Thus, you need to know the exact URL to determine the list of enabled
> > > IIS7 components for that URL ONLY. It can be different for another
> > > URL.
> >
> > > Currently, there is no managed code API for you to determine the
> > > merged list. It will be coming in Windows Server 2008 and
> > > should be available with Vista SP1 as well.
> >
> > > If you need to do this now, the APPCMD.EXE tool and the nativerd.h C-
> > > include file will be the best and only way.
> >
> > > //David
> > >http://w3-4u.blogspot.com
> > >http://blogs.msdn.com/David.Wang
> > > //- Hide quoted text -
> >
> > - Show quoted text -
>
>
> Ok, you want "presence/absence of specific DLLs of IIS7 Modules which
> are installed when the checkbox is checked."
>
> I don't know of an API to retrieve it (that's public, anyway) for
> Vista. There's a commandline tool for Windows Server 2008 that would
> query the installation state, which is only slightly better than the
> Registry hack.
>
> In the end, from a pre-requisite checking perspective, you have to
> decide if the registry key, CBS state, DLL existence, or feature is
> functional is the pre-requisite that you want. Why? Because you know
> it is possible to have registry key or CBS state to say one thing when
> reality is another, and DLL can be present but not enabled/functional.
> What level of detection is sufficient?
>
>
> //David
> http://w3-4u.blogspot.com
> http://blogs.msdn.com/David.Wang
> //
>
>

Re: How to detect which IIS 7 components are enabled?

am 22.10.2007 21:06:04 von melvers

In response to you very last question - the level detection is simply 'Is the
CheckBox checked or not' in the Windows Features UI.

"David Wang" wrote:

> On Oct 18, 1:16 pm, melvers wrote:
> > Thanks. You may see me in your blog as well. I will clarify what I am
> > trying to detect. I want to programatically (using C#) determine which boxes
> > were checked under the Internet Information Services item in the Turn Windows
> > features on or off UI.
> >
> >
> >
> > "David Wang" wrote:
> > > On Oct 18, 12:11 pm, melvers
> > > wrote:
> > > > I am looking for a way to determine programmatically, using C#, which IIS 7
> > > > components are currently enabled (not just installed). I have tried looking
> > > > at various registry keys that I have found on the Internet but none of them
> > > > seem to accurately reflect the current settings for which IIS 7 components
> > > > are enabled.
> >
> > > First, let me make sure I understand your terminology.
> >
> > > When you say "installed" you mean "presence/absence of specific DLLs
> > > of IIS7 Modules on the server machine" and "enabled" you mean "allowed
> > > by IIS7 to execute on a given request".
> >
> > > If the above is correct, then the state of "enablement" has never been
> > > in Registry keys (that's a hack for state of IIS7 module
> > > "installation") -- the enablement list is the merged list
> > > for a given URL. It is located inside of applicationHost.config by
> > > default, and further modified by child web.config files as permitted.
> >
> > > Thus, you need to know the exact URL to determine the list of enabled
> > > IIS7 components for that URL ONLY. It can be different for another
> > > URL.
> >
> > > Currently, there is no managed code API for you to determine the
> > > merged list. It will be coming in Windows Server 2008 and
> > > should be available with Vista SP1 as well.
> >
> > > If you need to do this now, the APPCMD.EXE tool and the nativerd.h C-
> > > include file will be the best and only way.
> >
> > > //David
> > >http://w3-4u.blogspot.com
> > >http://blogs.msdn.com/David.Wang
> > > //- Hide quoted text -
> >
> > - Show quoted text -
>
>
> Ok, you want "presence/absence of specific DLLs of IIS7 Modules which
> are installed when the checkbox is checked."
>
> I don't know of an API to retrieve it (that's public, anyway) for
> Vista. There's a commandline tool for Windows Server 2008 that would
> query the installation state, which is only slightly better than the
> Registry hack.
>
> In the end, from a pre-requisite checking perspective, you have to
> decide if the registry key, CBS state, DLL existence, or feature is
> functional is the pre-requisite that you want. Why? Because you know
> it is possible to have registry key or CBS state to say one thing when
> reality is another, and DLL can be present but not enabled/functional.
> What level of detection is sufficient?
>
>
> //David
> http://w3-4u.blogspot.com
> http://blogs.msdn.com/David.Wang
> //
>
>