Using the IIS 7 API you would do something like this
(http://www.iis.net/ConfigReference/system.applicationHost/sites):

Function CheckWebSiteExists(name)
        Set adminManager =
CreateObject("Microsoft.ApplicationHost.WritableAdminManager")
        adminManager.CommitPath = "MACHINE/WEBROOT/APPHOST"

        Set sitesSection =
adminManager.GetAdminSection("system.applicationHost/sites",
"MACHINE/WEBROOT/APPHOST")
        Set sitesCollection = sitesSection.Collection
        siteElementPos = FindElement(sitesCollection, "site",
Array("name", name))

        If (siteElementPos = -1) Then
            bSiteFound = False
        Else
            bSiteFound = True
        End If
...
End Function

Function FindElement(collection, elementTagName, valuesToMatch)
        Dim i, iVal
        Dim elem, prop
        Dim matches, value

        on error resume next

    for i = 0 to cint(collection.Count)
        Set elem = collection.Item(i)

                if err.number <> 0 then
                        err.clear
                        FindElement = -1
                        Exit Function
                end if

        if (elem.Name = elementTagName) then 
            matches = true

            for iVal = 0 to ubound(valuesToMatch) step 2

                set prop = elem.GetPropertyByName(valuesToMatch(iVal))
                value = prop.Value
                if (Not IsNull(value)) then
                    value = cstr(value)
                                end if
                if (value <> valuesToMatch(iVal + 1)) then
                    matches = false
                    exit for
                                end if
            next
            if (matches) then
                FindElement = i
                                Exit Function
            end if
        end if
    next
    FindElement = -1
End Function

Thanks,
Greg

-----Original Message-----
From: Chad Petersen [mailto:chad.peter...@harlandfs.com] 
Sent: Friday, October 21, 2011 12:53 PM
To: General discussion for Windows Installer XML toolset.
Subject: Re: [WiX-users] Validating Web site in IIS7 - WiX 3.5

My CA also works fine if I install the IIS6 Compatibility Layer on
Win2008 R2 Server as the old GetObject method uses the Metabase. Was
just hoping to avoid having to install that extra layer. Since we still
have to support 2003 Server right now I need this older method still for
that OS, but had planned on running that only on Win2003 and using some
newer method with Win2008 that didn't require that Compat layer.
Thoughts?

-----Original Message-----
From: John Cooper [mailto:jocoo...@jackhenry.com]
Sent: Friday, October 21, 2011 12:22 PM
To: General discussion for Windows Installer XML toolset.
Subject: Re: [WiX-users] Validating Web site in IIS7 - WiX 3.5

I query the IIS6 Metabase Compatibility layer (the custom action hasn't
been migrated to a pure IIS7 form using ServerManager ) to populate a
ComboBox (which gets queried for the "Default Web Site" if the UI is
suppressed).  In UI mode, A dialog box with the contents of the ComboBox
is displayed.  The site selected by the user is then used to initialize
a set of website properties (port, certificate, name, description, ip,
header).  An additional dialog is then displayed to allow the user to
override the default ports.  If the default ports are overridden,
additional custom actions run to update the ports (particularly
net.tcp).  In the non UI case, a custom action runs to harvest the UPN
username and password off selected AppPools on the "Default Web Site".
Both this CA and the binding (port) CA's use the IIS7 ServerManager
class.

--
John Merryweather Cooper
Jack Henry & Associates, Inc. (Premier Tech, Inc.) Build & Install
Engineer - jXchange
Office:  913-341-3434 x791011
jocoo...@jackhenry.com




-----Original Message-----
From: Chad Petersen [mailto:chad.peter...@harlandfs.com]
Sent: Friday, October 21, 2011 1:48 PM
To: General discussion for Windows Installer XML toolset.
Subject: [WiX-users] Validating Web site in IIS7 - WiX 3.5

Trying to figure out the right approach to validate that a Web site
already exists during my install. In IIS6 I used
GetObject("IIS://localhost/w3svc") and queried that for the info the
user typed in. Any of you that target IIS7+ how are you dealing with
this? I am using a Web site locator for an existing Web site rather than
creating my own Web site. I'd probably want to do this as a DoAction
during my InstallUISequence.

Suggestions or code snippets would be great!

Thanks
Chad


------------------------------------------------------------------------
------
The demand for IT networking professionals continues to grow, and the
demand for specialized networking skills is growing even more rapidly.
Take a complimentary Learning@Cisco Self-Assessment and learn about
Cisco certifications, training, and career opportunities. 
http://p.sf.net/sfu/cisco-dev2dev
_______________________________________________
WiX-users mailing list
WiX-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/wix-users
NOTICE: This electronic mail message and any files transmitted with it
are intended exclusively for the individual or entity to which it is
addressed. The message, together with any attachment, may contain
confidential and/or privileged information.
Any unauthorized review, use, printing, saving, copying, disclosure or
distribution is strictly prohibited. If you have received this message
in error, please immediately advise the sender by reply email and delete
all copies.


------------------------------------------------------------------------
------
The demand for IT networking professionals continues to grow, and the
demand for specialized networking skills is growing even more rapidly.
Take a complimentary Learning@Cisco Self-Assessment and learn about
Cisco certifications, training, and career opportunities. 
http://p.sf.net/sfu/cisco-dev2dev
_______________________________________________
WiX-users mailing list
WiX-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/wix-users



------------------------------------------------------------------------
------
The demand for IT networking professionals continues to grow, and the
demand for specialized networking skills is growing even more rapidly.
Take a complimentary Learning@Cisco Self-Assessment and learn 
about Cisco certifications, training, and career opportunities. 
http://p.sf.net/sfu/cisco-dev2dev
_______________________________________________
WiX-users mailing list
WiX-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/wix-users

------------------------------------------------------------------------------
The demand for IT networking professionals continues to grow, and the
demand for specialized networking skills is growing even more rapidly.
Take a complimentary Learning@Cisco Self-Assessment and learn 
about Cisco certifications, training, and career opportunities. 
http://p.sf.net/sfu/cisco-dev2dev
_______________________________________________
WiX-users mailing list
WiX-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/wix-users

Reply via email to