Bringing this back up because I'm having a related problem. Setting a property is no problem, but getting a property by a variable name turns out not to work. I'm running this powershell script from a custom action off a dialog, just to test the functionality.
This is an example of a line that returns no value:
[string] $props = "INSTALL_PROPS_PROPSTOSAVE"
$PropsToSave = AI_GetMsiProperty $props
But this does:
$PropsToSave = AI_GetMsiProperty INSTALL_PROPS_PROPSTOSAVE
Is there any way to make this work? I'm trying to load all properties from a file.
Code: Select all
function SaveProps()
{
$filepath = AI_GetMsiProperty SETUPEXEDIR
$filename = AI_GetMsiProperty INSTALL_PROPS_FILE
$file = $filepath + "\" + $filename + ".tmp"
[string] $props = "INSTALL_PROPS_PROPSTOSAVE"
$PropsToSave = AI_GetMsiProperty INSTALL_PROPS_PROPSTOSAVE
#$PropsToSave = AI_GetMsiProperty $props
"#Install Properties" > $file
foreach ($prop in $PropsToSave.Split(";"))
{
$val = AI_GetMsiProperty $prop
#if is not empty, add the property and value
if ($val)
{
$line = $prop + "=" + $val
} else {
$line = $prop + "=" + $prop.length
}
$line >> $file
}
}
SaveProps