ED209
ED209

Reputation: 638

Power Shell Invoking an MSI

I am trying to run an msi installer file using powershell. Below is my power shell code:-

$argumentlist = "/i D:\FolderTest\InstallerTest 1.9.0.39621 Setup.msi /qn /l*v D:\FolderTest\InstallLog.log"

Start-Process -FilePath "C:\Windows\System32\msiexec.exe" -ArgumentList $argumentlist

Every time I try to run this code though The Windows installer appears telling me that the argumentList variable isnt set correctly. Can anybody tell me what the problem is with this code?

Upvotes: 0

Views: 87

Answers (2)

Bill_Stewart
Bill_Stewart

Reputation: 24515

PowerShell is a shell. It's designed to run commands you type. You don't need to use Start-Process. Just type the command and press Enter.

PS C:\> msiexec /i "D:\FolderTest\InstallerTest 1.9.0.39621 Setup.msi" /qn /l*v "D:\FolderTest\InstallLog.log"

As with any command, if a parameter contains spaces, enclose it in quotes.

Upvotes: 1

4c74356b41
4c74356b41

Reputation: 72151

I think that spaces in the msi filename are what's preventing the msiexec to work properly. Try something like:
$argumentlist = "/i 'D:\FolderTest\InstallerTest 1.9.0.39621 Setup.msi' /qn /l*v D:\FolderTest\InstallLog.log"

Upvotes: 1

Related Questions