This topic contains 4 replies, has 4 voices, and was last updated by
December 18, 2015 at 2:10 am #33104ParticipantPoints: 0Rank: Member
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?
December 18, 2015 at 5:08 am #33105ParticipantPoints: 0Rank: Member
take a look into the Help for Start-Process. More so the examples to see how you can use this.
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.
December 18, 2015 at 5:54 am #33106MemberPoints: 0Rank: Member
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.
December 18, 2015 at 6:03 am #33108ParticipantPoints: 21Rank: Member
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\"'
December 18, 2015 at 7:11 am #33116ParticipantPoints: 0Rank: Member
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
In other words, the command that I've used was something like:
msiexec /a Application.msi /qn TARGETDIR="C:\Users\UserName\Desktop\Folder Name"
The topic ‘Cannot run msiexec command from PowerShell’ is closed to new replies.