Cannot run msiexec command from PowerShell


I am trying to run a command from PowerShell and it does not work, the result being only a Windows Installer window which explains the parameters of the command.
However, the same line does work when I run it from CMD.

The command that I’ve been trying to run from PowerShell is the following:

msiexec /a Application.msi /qn TARGETDIR=“C:\Users\UserName\Desktop\Folder”

First I thought that this is somehow related to permissions, but I am running PowerShell as admin and I’ve changed the ExecutionPolicy to unrestricted and the command still isn’t working. I have also tried to run this from a batch file without any luck.

Do you have any suggestion for making this running from PS?


Hey mate,

take a look into the Help for Start-Process. More so the examples to see how you can use this.

Start-Process \filename.msi


& \filename.msi

Either or should work fine. Also if you want to pass arguments to your .msi you can so do something along the lines of:

Start-Process ‘\filename.msi’ -ArgumentList ‘Args here’

let us know how you go.

Strange. I don’t see anything wrong with your command, and I’ve successfully used msiexec from PowerShell.

Just for giggles, try retyping the command; no copy and paste. Maybe there’s some unprintable character in your command that’s goofing things up.

Here’s an old example of how I’ve done it in the past.

$execute = “msiexec.exe”

$parameters = ’ /i “e:\apps\QuestChangeAuditorAgent5(x64).msi” /qb INSTALLDIR=“E:\Program Files\Quest Software\ChangeAuditor” INSTALLATION_NAME_VALID=1 INSTALLATION_NAME=“DEFAULT” REBOOT=“ReallySuppress” ALLUSERS=1 STAGINGPATH=“C:\Windows\TEMP”’

$process= [System.Diagnostics.Process]::Start($execute,$parameters)


Hello guys!

Thank you very much for the help! Now I’ve managed to run the command.

It seems that I had an extra space in the naming of the folder used as TARGETDIR. Unlike CMD, PowerShell did interpret it wrong, although the path was inside
quotation marks.

In other words, the command that I’ve used was something like:
msiexec /a Application.msi /qn TARGETDIR=“C:\Users\UserName\Desktop\Folder Name”

Thanks again!