cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
RiaanGouws
Level 3

Property going missing in UI - Windows 7 / 2008 issue

Hi

I recently implemented a web site selection dialog based on the advise I got from this forum. The dialog works like a charm, where my dropdown shows all the sites installed for the pc.

The vbscript routine that gets the sites works well for IIS 6, 7 & 7.5. I tested it. The routine populates a property called WEBSITE_DROPDOWN, code snippet at end of post.


It works 100% on Windows 2003, but for some reason my dropdown is empty on Windows 7 and 2008! There are no errors in my log file. The WEBSITE_DROPDOWN property is in the SecureCustomProperties property.

Please help!



CODE SNIPPET:
On Error Resume Next

Dim objView
Dim objDB
Dim objInstaller
Dim objRecord
Dim objW3SVC
Dim objIisWebSite
Dim lngOrder
Set objDB = Session.Database
Set objInstaller = Session.Installer


Set objView = objDB.OpenView("select * from ComboBox")

lngOrder = 1
if Session.Property("VersionNT")<600 then ' Windows 2003

Set objW3SVC = GetObject("IIS://localhost/W3SVC")

For Each objIisWebSite In objW3SVC
If 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 = objInstaller.CreateRecord(4)
objRecord.StringData(1) = "WEBSITE_DROPDOWN" ' property name
objRecord.IntegerData(2) = lngOrder ' order
objRecord.StringData(3) = objIisWebSite.ServerComment ' value
objRecord.StringData(4) = objIisWebSite.ServerComment
Call objView.Execute(objRecord) ' now add the record to the table
Call objView.Modify(7, objRecord) ' (7 = msiViewModifyInsertTemporary)

lngOrder = lngOrder + 1
End If
End If
Next
Else
Set oIIS = GetObject("winmgmts:root\WebAdministration")

Set oSites = oIIS.InstancesOf("Site")
For Each oSite In oSites

Set objRecord = objInstaller.CreateRecord(4)
objRecord.StringData(1) = "WEBSITE_DROPDOWN" ' property name
objRecord.IntegerData(2) = lngOrder ' order
objRecord.IntegerData(3) = oSite.Name
objRecord.StringData(4) = oSite.Name
Call objView.Execute(objRecord) ' now add the record to the table
Call objView.Modify(7, objRecord) ' (7 = msiViewModifyInsertTemporary)
lngOrder = lngOrder + 1

Next
end if

Call objView.Close
Labels (1)
0 Kudos
4 Replies
Ajay_Ladsaria
Level 7

Here are some troubleshooting ideas that should help to diagnose this problem further:

1. Try putting in some default values in the ComboBox table as a test. This will verify that the ComboBox items show up correctly as long as the table is populated. If the default values don't show up, then the problem may be that the height of the ComboBox is not big enough.

2. Put in some msgbox calls in your vbscript to verify that it does find the website information when running in a custom action in your MSI (I know you have verified it outside of the MSI, but this is just a sanity check).

3. Maybe try testing your MSI by launching msiexec from an elevated command prompt or by turning UAC off.

-Ajay
0 Kudos
Christopher_Pai
Level 16

VBScript Custom Actions in general ( and certainly ones that begin with On Error Resume Next ) never end well.

If you need to write unmanaged custom actions, I suggest C++ or InstallScript. InstallSite has a DLL that will help in collection enumeration. If you can take a dependency on .NET 2.0(+) then I reccomend C# or VB.NET DTF.

You will be able to do proper exception handling and debugging of your code. Anything you do to fix your vbscript problem today is frankly just a bandaid.
0 Kudos
RiaanGouws
Level 3

In the words of the indomitable Homer Simpson - DOH!

A simple bug caused my problem:
objRecord.IntegerData(3) = oSite.Name

should be

objRecord.StringData(3) = oSite.Name

Ajay's approach helped me find the issue, but ultimately Christopher gave me the idea of getting rid of the on error resume next line.

It is weird how one can stare blindly at a piece of code and not see the obvious issue...
0 Kudos
Christopher_Pai
Level 16

I suggest reading:

http://blogs.msdn.com/b/robmen/archive/2004/05/20/136530.aspx

The advice is over 6 years old and every bit true today. This custom action will fail you(r customer) again one day.
0 Kudos