/build/static/layout/Breadcrumb_cap_w.png

MSIEXEC command to install and repair?

Does anyone know if it is possible to use a single command to install a MSI if it is not already installed, and if it is installed to run a repair/reinstall?

We are using SCCM and would like our users to be able to install an application from Run Advertised Programs, and if they need to repair/reinstall the application e.g. they have accidentally deleted the shortcuts etc. they simply re-run the same advertisement and the command line will accommodate both actions.

I have experimented with running the following command: 'MSIEXEC /i Application.msi /QB REINSTALL=ALL' and this (obviously) works if the application is already installed but does not install the application if it is not installed.

Any assistance is appreciated.

0 Comments   [ + ] Show comments

Answers (2)

Posted by: anonymous_9363 14 years ago
Red Belt
0
Your best option is to use a script, in which you can test for the product's installed state using the WindowsInstaller.Installer object. If it's installed, do a repair. If not, install. The object model is fully documented on MSDN.

BTW, one of the big advantages of using the WI engine is that applications can self-heal, if the installation package is properly constructed.
Posted by: timmsie 14 years ago
Fourth Degree Brown Belt
0
this script will help you, we use it as a pre-req sometimes in sms to determine whether an app is installed or advertised and then uninstall it.
you'll have to change it a bit for your scenario but it's a start

Option Explicit

Const productCode = "{xxxx-xxx-xxxx-xxxxxxx}"
Const productFeat = "Complete"

Const msiProdAdvertised = 1
Const msiProdInstCurrUser = 5

Const msiInstallStateAdvertised = 1
Const msiInstallStateLocal = 3
Const msiInstallAllFeatures = 65535

Dim msiObject : Set msiObject = CreateObject("WindowsInstaller.Installer")
Dim objShell : Set objShell = CreateObject("WScript.Shell")

' Check existing product state
If (msiObject.ProductState(productCode) <> msiProdAdvertised) And (msiObject.ProductState(productCode) <> msiProdInstCurrUser) Then
' Package is neither advertised or installed so exit the script with error code 0 to satify SMS pre-requisite
WScript.Quit(0)
Else
On Error Resume Next
' If main product feature is either advertised or installed, call uninstall routine via msiexec command line
If (msiObject.FeatureState(productCode, productFeat) = msiInstallStateAdvertised) Or _
(msiObject.FeatureState(productCode, productFeat) = msiInstallStateLocal) Then
objShell.Run("msiexec.exe /x {xxxxx-xxxxx-xxxx-xxxx} /qb!"),1,True
End If
End If
Rating comments in this legacy AppDeploy message board thread won't reorder them,
so that the conversation will remain readable.
 
This website uses cookies. By continuing to use this site and/or clicking the "Accept" button you are providing consent Quest Software and its affiliates do NOT sell the Personal Data you provide to us either when you register on our websites or when you do business with us. For more information about our Privacy Policy and our data protection efforts, please visit GDPR-HQ