Hi;

Note: I looked at
http://www.microsoft.com/technet/scriptcenter/scripts/iis/default.mspx?mfr=true and I could not find solutions to any of the below:

I know this can be done because the pre-install for SqlServer does all this.

1) How can I tell if IIS is installed?

2) If not installed, how can I kick off the installation - I know this uses
the Add/Remove applet but how do I kick this off so it starts with install
IIS selected?

Note: I do NOT want to do an unattended install as most users want to know
what is being installed and may want to change the location of
c:\inetpub\wwwroot. I need to just start the install.

3) If installed, how do I tell if IIS is enabled and if not enabled, how do
I enable it?

--
thanks - dave
david_at_windward_dot_net
http://www.windwardreports.com

Cubicle Wars - http://www.windwardreports.com/film.htm

RE: Asking again - how do I tell if IIS is installed & enabled by wjzhang

wjzhang
Thu Nov 23 06:08:59 CST 2006

Hi Dave,

1) How can I tell if IIS is installed?

As I mentioned before, you can detect this by querying registry or metabase.

2) If not installed, how can I kick off the installation - I know this uses
the Add/Remove applet but how do I kick this off so it starts with install
IIS selected?

There is no command to start IIS installation directly except performing an
unattended installation. Using the following command can start Add/Remove
Windows Components dialog:

sysocmgr /i:%windir%\inf\sysoc.inf

3) If installed, how do I tell if IIS is enabled and if not enabled, how do
I enable it?

What's the exact meaning of 'enabled' here? Do you mean you want to check
if a special web site is started but not stopped? Or you want to check if
IIS service is running?

IMHO, even if IIS service and web site are started, we still cannot
determine if the web is running properly. Maybe a most straight-forward way
to check this is sending a http request to 80 port and check if it returns
a 200 OK response.

Thanks.

Sincerely,

WenJun Zhang

Microsoft Online Community Support

==================================================

Get notification to my posts through email? Please refer to:
http://msdn.microsoft.com/subscriptions/managednewsgroups/default.aspx#notif
ications.

Note: The MSDN Managed Newsgroup support offering is for non-urgent issues
where an initial response from the community or a Microsoft Support
Engineer within 1 business day is acceptable. Please note that each follow
up response may take approximately 2 business days as the support
professional working with you may need further investigation to reach the
most efficient resolution. The offering is not appropriate for situations
that require urgent, real-time or phone-based interactions or complex
project analysis and dump analysis issues. Issues of this nature are best
handled working with a dedicated Microsoft Support Engineer by contacting
Microsoft Customer Support Services (CSS) at:

http://msdn.microsoft.com/subscriptions/support/default.aspx.

==================================================

This posting is provided "AS IS" with no warranties, and confers no rights.





RE: Asking again - how do I tell if IIS is installed & enabled by thielen

thielen
Fri Nov 24 14:49:01 CST 2006

Hi;

For item (2) - that is exactly what I was looking for.

For (1) I have found:
ServiceController[] scServices = ServiceController.GetServices();
foreach (ServiceController srvc in scServices)
if (srvc.ServiceName.ToUpper() == "W3SVC")
return true;
return false;

For (3) I am checking the service to see if it is running and if it is set
to start automatically when the system starts.

--
thanks - dave
david_at_windward_dot_net
http://www.windwardreports.com

Cubicle Wars - http://www.windwardreports.com/film.htm




""WenJun Zhang[msft]"" wrote:

> Hi Dave,
>
> 1) How can I tell if IIS is installed?
>
> As I mentioned before, you can detect this by querying registry or metabase.
>
> 2) If not installed, how can I kick off the installation - I know this uses
> the Add/Remove applet but how do I kick this off so it starts with install
> IIS selected?
>
> There is no command to start IIS installation directly except performing an
> unattended installation. Using the following command can start Add/Remove
> Windows Components dialog:
>
> sysocmgr /i:%windir%\inf\sysoc.inf
>
> 3) If installed, how do I tell if IIS is enabled and if not enabled, how do
> I enable it?
>
> What's the exact meaning of 'enabled' here? Do you mean you want to check
> if a special web site is started but not stopped? Or you want to check if
> IIS service is running?
>
> IMHO, even if IIS service and web site are started, we still cannot
> determine if the web is running properly. Maybe a most straight-forward way
> to check this is sending a http request to 80 port and check if it returns
> a 200 OK response.
>
> Thanks.
>
> Sincerely,
>
> WenJun Zhang
>
> Microsoft Online Community Support
>
> ==================================================
>
> Get notification to my posts through email? Please refer to:
> http://msdn.microsoft.com/subscriptions/managednewsgroups/default.aspx#notif
> ications.
>
> Note: The MSDN Managed Newsgroup support offering is for non-urgent issues
> where an initial response from the community or a Microsoft Support
> Engineer within 1 business day is acceptable. Please note that each follow
> up response may take approximately 2 business days as the support
> professional working with you may need further investigation to reach the
> most efficient resolution. The offering is not appropriate for situations
> that require urgent, real-time or phone-based interactions or complex
> project analysis and dump analysis issues. Issues of this nature are best
> handled working with a dedicated Microsoft Support Engineer by contacting
> Microsoft Customer Support Services (CSS) at:
>
> http://msdn.microsoft.com/subscriptions/support/default.aspx.
>
> ==================================================
>
> This posting is provided "AS IS" with no warranties, and confers no rights.
>
>
>
>
>

Re: Asking again - how do I tell if IIS is installed & enabled by David

David
Fri Nov 24 16:55:58 CST 2006

1. What IIS versions are you planning to support?
2. Unattend IIS installation IS the only way to do this
3. Do you ensure that a website is started and listening on the
expected IP:Port:Host

Reconsider if you even need code to do #1 based on how #2 works and
your dependenc