Hi All,
My setup project has a checkbox dialog where the user can select to install different parts of the application. I set the Checkbox1Property to EXFUNC (default checked) and this works as expected with Condition (EXFUNC=1) on the exportfunction files.
Now I need to make a silent installation, but still be able to select parts of the application from a script, I tried this:
msiexec /quiet /i myapp.msi EXFUNC=0
This does not work, and in the logfile I found that the property still evaluated to 1
Property(S): CHECKBOXA1 = 1
Property(S): EXFUNC = 1
Whats wrong with this scenario How can I set values to properties from the command line
Thanks

Changing checkbox selection from msiexec command line
Dennis Berry
I haven't had a chance to fully investigate, but I think there is a slight (but very important) flaw in the generated MSI. Technical details:
In the CustomAction Table, we see the following entry:
Action: CustomCheckA_SetProperty_CHECKBOX1
Type: 307
Source: EXFUNC
Target: <empty> or "1"
When run, this custom action will set the property EXFUNC to be empty (deleted) or "1" (depending on the value you chose in the CheckBox1Value of your dialog). When UI is shown, this custom action is used to initialize what is displayed in the checkbox. Note that even if UI Were shown, the commandline value you passed in would be overrideen by this custom action.
So the key is to not have this custom action run if the value has already been defined earlier in the install, whether that is because the custom action has already been run as part of initializing the UI, or whether its been set via the command line.
The first case was supposed to be taken care of when the CustomAction Type was set to 307, which would mean that once the action was run, it wouldn't be run later. That just leaves the second case: we don't want this action to run if EXFUNC already has a value.
This is accomplished by conditioning the CustomAction in the InstallExecuteSequence and InstallUISequence. There doesn't appear to be a way to do this via the UI, so this needs to be accomplished as a post build step. The following jscript should do the trick:
var msiOpenDatabaseModeTransact = 1;
var msiViewModifyInsert = 1
var msiViewModifyUpdate = 2
var msiViewModifyAssign = 3
var msiViewModifyReplace = 4
var msiViewModifyDelete = 6
if (WScript.Arguments.Length != 1)
{
WScript.StdErr.WriteLine(WScript.ScriptName + " file");
WScript.Quit(1);
}
var filespec = WScript.Arguments(0);
var installer = WScript.CreateObject("WindowsInstaller.Installer");
var database = installer.OpenDatabase(filespec, msiOpenDatabaseModeTransact);
SetConditionOfAction("CustomCheckA_SetProperty_CHECKBOX1", "InstallExecuteSequence", "EXFUNC=\"\"");
SetConditionOfAction("CustomCheckA_SetProperty_CHECKBOX1", "InstallUISequence", "EXFUNC=\"\"");
database.Commit();
function SetConditionOfAction(action, table, condition)
{
var sql = "SELECT `Action`, `Condition`, `Sequence` FROM " + table + " WHERE `Action`='" + action + "'";
var view = database.OpenView(sql);
view.Execute();
var record = view.Fetch();
record.StringData(2) = condition;
view.Modify(msiViewModifyReplace, record);
view.Close();
}