AnswerYou can choose to let the installing user view and
select available Web Sites, Virtual Directories and Web
Applications on IIS Server. Advanced Installer can automatically browse
the IIS Server to discover all its Web Sites, Virtual Directories and
Web Applications. Launch the "Browse Web Sites &
Virtual Directories" wizard from the IIS toolbar and follow the
instructions.
Create a new dialog called
"BrowseIIS", added after "WelcomeDlg" in the dialogs tree.
On this dialog you can place either a ComboBox or
a ListBox control with associated Windows Installer properties:
IISBrowseComboBox and
IISBrowseListBox, respectively. This control will
receive the information about the enumerated IIS entities on the
server. You can use this functionality with any other dialog of your choice,
or you can customize some of Advanced Installer built-in dialogs.
Although the operation of enumerating Web Sites
and Virtual Directories on the IIS server does not alter
its configuration, for security reasons, the system
does not allow accessing any IIS configuration properties without
administrator privileges. Due to this security
policy, the installing user must be a member of the
Administrators group and, on Windows Vista or above,
an UAC Elevation will be necessary in order to
proceed.
This predefined custom action will automatically
trigger the necessary UAC Elevation Prompt for
you, enabling temporary elevated privileges to execute
the IIS browsing operation, so there is no need to elevate the MSI
execution beforehand (manually or by means of the
bootstrapper). For the button which
uses this custom action you should set the Elevation Shield control property to
True. This will make the OS (Vista, and above) show an
elevation shield on the button when the installation runs, in order to
warn the installing user that an elevation request
is about to happen when the button is pressed.
Input ParametersSelect the [ Next ] button control from the previous
dialog ("WelcomeDlg"). On this control you need to
"set-up" the predefined custom action that browses
the IIS server entities. The following input parameters can be
specified (optionally) through Windows Installer properties. You can set these properties
statically (from Install Parameters), or dynamically (from the installer UI - associated with Dialog Controls, or with SetProperty
Initialization Events / Published Events). - IISBrowseHideVDirs - set this property to
"1" if you want to list only
Web Sites on the IIS Server.
- IISBrowseOnlyWebApps - set this property
to "1" if you want to list
only Web Sites or Virtual Directories that are
web applications.
- IISBrowseShowExtInfo - set this property
to "1" if you want to show
detailed information about each IIS entity listed,
not just its name or virtual path.
(Detailed information includes: website ID, bindings, service state,
physical path, web application, etc.)
- IISBrowseOutputMode (optional) - set this
property to one of the values: 0 - default
(website name/virtual directory path), 1
(physical path), 2 (website index),
3 (website bindings),
4 (website state), 5
(ADS path); the value of this property will control what will be
stored in each item data from the output ListBox or
ComboBox control.

Finally, add an Control Event with the following
settings: - Name: DoAction
- Argument: BrowseIIS (the name of the custom
action you created earlier)
- Condition: 1

IIS Browse Result (output)Advanced Installer dumps the result of the browse operation (the IIS items
list) in the following locations: - Any ComboBox control that has the property
IISBrowseComboBox associated with it.
- Any ListBox control that has the property
IISBrowseListBox associated with it.
- A flat, comma separated list of IIS Web
Sites and Virtual Directories will be
dumped into the IISBrowseOutput property. You
can use this value if you wish to do any custom
processing of the IIS items list.
For ComboBox and ListBox controls,
the output format will be as follows: - Item value: web site name, or
virtual directory path (Eg. Default Web
Site, or Default Web
Site/VDIR_1)
- Item text: By default, the item text is equal to the item
value. If IISBrowseShowExtInfo property is set
to "1" , then more details are available in
the list/combo item text: website ID, bindings, service state,
physical path, web application, etc. (Eg. SITE: "Default
Web Site" (id: 1; bindings:
11.0.0.133:80:www.example.com,:443:secure.example.com; state:
STARTED; physicalPath: "C:\inetpub\wwwroot") WEBAPP, or
VDIR: "Default Web Site/MyApp" (physicalPath:
"D:\WebRoot\MyApp") WEBAPP).
By default the [website name]/[virtual directory path] will be
stored as the list/combo item data. If you want a different parameter
to be extracted from the user selection, choose it from the options
above. The result will be stored in the "IISBrowseSelectedValue"
property. This property value will be set only after the
"IIsDecodeBrowseResult" custom action is executed (on the [Next]
button from the dialog).
Sample Project You can find a small sample Advanced Installer project implementing the above
functionality here.
|