Run MsiExec from PowerShell and get Return Code
With BAT/CMD script I can simply use "msiexec /i <whatever.msi> /quiet /norestart" and then check %errorlevel% for the result. With VBScript , using the Wscript.Shell object Run() method, I can get the result like this: "result = oShell.Run("msiexec /i ...", 1, True)" How can I do this with PowerShell? I would wrap that up in Start-Process and use the ExitCode property of the resulting process object. For example (Start-Process -FilePath "msiexec.exe" -ArgumentList "<<whatever>>" -Wait -Passthru).ExitCode $LastExitCode or $? depending on what you're after. The former is an integer, the latter