Summary
Retrieve Websites in IISSynopsis
The following VBScript code queries IIS, retrieves a list of websites on localhost, and displays the websites in a ComboBox control.
Discussion
The following VBScript code populates a ComboBox control with the websites by directly modifying the ComboBox table. A custom dialog still needs to be created that includes this ComboBox control.
If using an InstallScript or InstallScript MSI project type, the following code can be modified to send the list of websites to a list, which can then be displayed in an InstallScript dialog. You would replace the code in the commented sections to route the data into a list.
Dim objViewDim objRecordDim objW3SVC, objIisWebSiteDim lngOrderSet objView = Session.Database.OpenView("select * from ComboBox")
' enumerate webservers on localhost and populate ComboBox tableSet objW3SVC = GetObject("IIS://localhost/W3SVC")lngOrder = 1
For Each objIisWebSite In objW3SVCIf objIisWebSite.Class = "IIsWebServer" Then If LCase(objIisWebSite.ServerComment) <> "administration web site" Then
' add site name to ComboBox table (which is used by our dialog ComboBox) Set objRecord = Session.Installer.CreateRecord(4) objRecord.StringData(1) = "WT1_IISWebSite" ' property name objRecord.IntegerData(2) = lngOrder ' order objRecord.StringData(3) = objIisWebSite.Name ' value objRecord.StringData(4) = objIisWebSite.ServerComment ' text
' now add the record to the table objView.Modify 7, objRecord ' (7 = msiViewModifyInsertTemporary) lngOrder = lngOrder + 1 End IfEnd If
NextobjView.Close
Additional Information
This code was submitted by user rasmusmoller from the InstallShield Community.
IIS support in InstallShield is fully documented in the InstallShield Help Library, including the following articles:
Related Articles
How to Display Properties in Dialog for InstallScript MSI 4Number of Views Installing Multiple Websites using INSTALLSHIELD_IIS_NEXT_NEW_SITE_NUMBER 5Number of Views Retrieve and Display List of Machine Names and IP Addresses On Domain To User 5Number of Views "HTTP Error 500.19" error when you browse or a component access IIS website in Windows 39Number of Views Detect .NET Framework 4.6 And Display A Show Message Dialog Indicating Whether .NET Framework 4.6 Was Detected with Instal… 5Number of Views
Hi, I am Reva - Ask me anything.
No new updates
Thanks for the feedback!
Your feedback has been saved.Rate this response:
Add Additional feedback ( Optional )
Are you sure you want to cancel
the case creation?
Are you sure you want to cancel the case creation?
Are you sure you want to close this case
| Products | Region | Phone Numbers |
|---|---|---|
| FlexNet Operations FlexNet Embedded FlexNet Publisher FlexNet Connect FlexNet Code Insight InstallAnywhere InstallShield |
North America * |
+1 630-332-2513 (toll) +1 877-279-2853 (toll-free in North America) |
| Europe * |
+44 1925 944367 (toll) +44 800 047 8642 (toll-free in Europe) |
|
| Japan * | +81 3-4540-5335 (select option 2) | |
| Australia * |
+61 3 9895 2177 +61 1800 560 603 (toll-free in Australia) |
|
|
Usage Intelligence (formerly
Revulytics) Compliance Intelligence |
Please use the Case Portal to submit your support ticket or reach out to your Revenera contact. | |
Revenera Assistant
Case id: 00001065
Activity: Status change: 2 hours ago