Hello Robert,
Alternatively, is there a way to get the msiexec command line and its switches passed
like /i or /x, etc.?
This may indeed be possible, but unfortunately I am not aware of any method in which you can achieve it.
Is there a way to figure out in PowerShell Inline Custom Action
what is doing the installer - installing, uninstalling, updating, etc.?
Yes, there is a way. We can achieve this through Windows Installer properties. For instance, the properties for your scenarios are:
-
Installed ---> Here, we play around the fact that either this property exists (has a value) or not (doesn't have a value). For installed, the condition for a first time install is:
Basically, the above condition means the "Installed" property does not exist.
We can do something similar in PowerShell, as it follows:
Code: Select all
$installed = AI_GetMsiProperty Installed
if ($installed -eq ""){
# this means that a first time install is happening
}
-
REMOVE ---> The basic condition for uninstall is:
With this in mind, we can achieve the same behavior in PowerShell, as it follows:
Code: Select all
$remove = AI_GetMsiProperty REMOVE
if($remove = "ALL"){
# this means an uninstall is happening
}
-
OLDPRODUCTS ---> This is a property that is set only during an upgrade. The condition for an upgrade is:
(basically, the property exists)
We can achieve the same in PowerShell, as it follows:
Code: Select all
$oldproducts = AI_GetMsiProperty OLDPRODUCTS
if ($oldproducts -neq ""){
# this means an upgrade is performed
}
Hope this helps.
Best regards,
Catalin
FOLLOW US
Get the latest news in Application Packaging