InstallerContactSite Map

Answer

You can choose to let the installing user view and select available Web Sites, Virtual Directories and Web Applications on IIS Server. Advanced Installer, starting with version 6.7, can automatically browse the IIS Server to discover all its Web Sites, Virtual Directories and Web Applications.

Custom actions Go to the Custom Actions page and add the predefined UI Custom Action "Browse IIS Web Sites & Virtual Directories".

Browse IIS custom action

Dialog editorGo to the Dialog Editor page.

New dialogCreate 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.

TipYou can use this functionality with any other dialog of your choice, or you can customize some of Advanced Installer built-in dialogs.

Caution!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).

UACFor 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 Parameters

Select 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.)

SetProperty Control Events

Finally, add an Control Event with the following settings:

  • Name: DoAction
  • Argument: BrowseIIS (the name of the custom action you created earlier)
  • Condition: 1

DoAction Control Event

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 (names only) 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).

Sample Project

NoteYou can find a small sample Advanced Installer project implementing the above functionality here.