Welcome to ShenZhenJia Knowledge Sharing Community for programmer and developer-Open, Learning and Share
menu search
person
Welcome To Ask or Share your Answers For Others

Categories

I've googled and not found anything useful to me.

I have 4 msi files I want to install but would like to check if some of it is installed on the computer.

Example: check if program 1 is installed, if not install it and go to and install program 2. However if it's not installed, install it and go to program 2 and do the same test there.

Execute-MSI -Action Install -Path "$dirFilesProgram1"
Execute-MSI -Action Install -Path "$dirFilesProgram2"
Execute-MSI -Action Install -Path "$dirFilesProgram3"
Execute-MSI -Action Install -Path "$dirFilesProgram4"
See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
thumb_up_alt 0 like thumb_down_alt 0 dislike
307 views
Welcome To Ask or Share your Answers For Others

1 Answer

If you know the GUID, you could test path the uninstall key. Also don't forget that if your OS is 64 bit, there will be the same key in WOW6432Node for 32 bit apps.

$uninstallkey = "HKLM:SoftwareMicrosoftWindowsCurrentVersionUninstall"
$uninstall32key = "HKLM:SoftwareWOW6432NodeMicrosoftWindowsCurrentVersionUninstall"
#Example 64-bit app
$app1guid = "{XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX}"
if (!(Test-Path "$uninstallkey$app1guid)) {Execute-MSI -Action Install -Path "$dirFilesProgram1"}
#Example 32-bit app
$app2guid = "{XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX}"
if (!(Test-Path "$uninstall32key$app2guid)) {Execute-MSI -Action Install -Path "$dirFilesProgram1"}

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
thumb_up_alt 0 like thumb_down_alt 0 dislike
Welcome to ShenZhenJia Knowledge Sharing Community for programmer and developer-Open, Learning and Share
...