Search code examples
powershellwindows-installerparameter-passingstart-process

The argument is null or empty: Start-Process error when invoking msiexec.exe for uninstallation


Get-Process | ? {$_.ProcessName -eq "DellCommandUpdate"} | Stop-Process -Force

$Params = @(
    "/qn"
    "/norestart"
)

Start-Process "msiexec.exe" -ArgumentList $Params -Wait

I'm trying to uninstall Dell Command Update from a few laptops with older versions. I'm getting this error, below?

screenshot


Solution

  • Msiexec.exe requires the path to the program you want to install or uninstall.
    You also need the /x flag to specify that it is an uninstall, otherwise you're going to run it as an install. Try this:

    $MSIExec = "msiexec.exe"
    $Params = @(
        "/qn",
        "/norestart",
        "/x",
        "<Path to package.msi>"
    )
    & "$MSIExec" $Params
    

    I'm inclined to consider this a duplicate question to the more generic "How do I run executable files with arguments in Powershell" question which has a similar answere here: https://stackoverflow.com/a/22247408/1618897

    But, considering this is a new account, and you clearly showed what you've done, I think this is still valid.

    EDIT: This answer runs asynchronously, see mklement0's answer for a 1:1 solution for a synchronous solution (which matches this question directly).