I am using powershell and WMI to install msi package on remote machine, and getting return value 3 when trying to install. It's strange, because before installation my script checks for installed product, and if it is present uninstalls it. Uninstall is completeing successfully.
I googled for return value 3 of install method - but there is nothing.
Do anyone know something about this return code?
Thanks.
EDIT: Here is the code.
function InstallPJM([string]$packagePath, [string]$machineName)
{
Write-Host “Installing from $packagePath on $machineName”
#1
(Get-WMIObject -ComputerName $machineName -List | Where-Object -FilterScript {$_.Name -eq "Win32_Product"}).Install($packagePath)
#$product = [WMICLASS]“\\$machineName\ROOT\CIMV2:win32_Product”
#2
#$product.Install($packagePath, "", "True")
}
Function call:
InstallPJM "C:\PJM7DeploymentFolder\Pjm7.msi" "MachineName"
I tried 2 ways (numbered strings): each of them gives ReturnValue 3