Using VBS to control Feature installation - Advanced Installer Community

We’re moving our forums to a new platform.

You can still browse and search existing topics, but you can no longer create new topics or post replies.

For questions, technical issues, or feature requests, please don’t hesitate to contact our support team at support@advancedinstaller.com.

Thank you for your understanding!

ssearles
Posts: 65
Joined: Tue Oct 30, 2007 12:54 pm

Using VBS to control Feature installation

I have a VBS that checks the local machine to determine what kind of PC it is (Server, Laptop, Workstation) and returns a string value. How can I use that output to determine if a particular feature in my MSI is installed or not automatically?

For instance, I have a feature (complete with a litany of directories/files/registry stuff) that I only want to install if the machine is a Laptop, and a completely different feature that installs only on Servers.

I've tried getting a custom action to twiddle with INSTALLLEVEL but for some reason I just can't seem to get it to work right (it either installs the entire features on everything, or doesn't at all).


Help!

.. and thx in advance,
ssearles

PS: Oh, and I want to be able to run my installer silently with no user interaction needed... :?
Cosmin
Posts: 5797
Joined: Tue Jul 10, 2007 6:39 pm
Contact: Website

Re: Using VBS to control Feature installation

Hi,

What you need can be done by controlling the feature action of each feature. Please note that the User Guide contains the Show a custom feature selection dialog how-to which uses the Session.FeatureRequestState object to set feature actions based on a property.

Regards,
Cosmin
Cosmin Pirvu - Advanced Installer Team
Follow us: Twitter - Facebook - YouTube
ssearles
Posts: 65
Joined: Tue Oct 30, 2007 12:54 pm

Re: Using VBS to control Feature installation

cosmin,

Ok, then I must be doing something wrong... here is my simply function:

Code: Select all

Sub Test4
' Set contants for the INSTALLSTATE_ABSENT and INSTALLSTATE_LOCAL feature states
Const msiInstallStateAbsent = 2
Const msiInstallStateLocal  = 3
Dim compType
compType = FindCompType() 'this function returns values of "Laptop" if machine is such

Session.FeatureRequestState("Feature1") = msiInstallStateAbsent
MsgBox "Feature1 will not install right now"

' Set the install state of the feature with the identifier "LocalWorkspaceXM"
If compType = "Laptop" Then 
	Session.FeatureRequestState("Feature1") = msiInstallStateLocal
	MsgBox compType & "Found! - Feature1 WILL install"
End If

End Sub
Feature1 is the identifier of my feature under Properties. All that's associated with it is an empty subfolder called TESTFOLDER.

When I run it as a debug (without only the MsgBox's) manually it flags fine, but when I put that into a simple MSI as a Custom Action (InstallUISequence > Begin) the directory always gets created, even on a machine that is not throwing a 'Laptop' value.


what am i missing :?:
Cosmin
Posts: 5797
Joined: Tue Jul 10, 2007 6:39 pm
Contact: Website

Re: Using VBS to control Feature installation

Hi,

The script seems to be correct. I'm not sure why you are encountering this behavior. Can you please send us the AIP you are using to support at advancedinstaller dot com so we can investigate it?

Regards,
Cosmin
Cosmin Pirvu - Advanced Installer Team
Follow us: Twitter - Facebook - YouTube

Return to “Common Problems”