# How to call msiexec from powershell with parameters

I am trying to execute the following line from a powershell script:

msiexec /qb /i ps-pulse-win-5.2r5.1-b897-64bitinstaller.msi CONFIGFILE="ALS GSLB.jnprpreconfig"


This works when called from a DOS command line, but MSIEXEC complains that things aren't right when I call it from powershell.

This does work...

msiexec /qb /i ps-pulse-win-5.2r5.1-b897-64bitinstaller.msi

Obviously SOMETHING is messing with my arguments, but I can't figure out how to make it work.

(Removed the "/")

I just used Powershell to install GAPS on my core servers, and I had a command like this. I like this more verbose syntax because it is more readable, and I can include comments per command line option to save myself and others time re-used the command in the future.

$cmdhash=@{}$cmdhash['FilePath']    = 'C:\Windows\System32\msiexec.exe'
$cmdhash['Wait'] =$true
$cmdhash['NoNewWindow'] =$true
$cmdhash['ArgumentList']=@()$cmdhash['ArgumentList'] += '/i \\esd189.org\dfs\wpkg\software\Google\GAPS\googleappspasswordsync64.msi'
$cmdhash['ArgumentList'] += '/l*vx C:\programdata\gaps_msi_log.txt'$cmdhash['ArgumentList'] += '/quiet'
$cmdhash['ArgumentList'] += 'DOMAIN="example.org"'$cmdhash['ArgumentList'] += 'ADMIN_EMAIL="googlesync@example.org"'
$cmdhash['ArgumentList'] += 'CREDENTIALS_FILE="\\ds-01\c$\Users\svc-googlesync\Documents\example.json"'
$cmdhash['ArgumentList'] += 'BASE_DN="DC=example,DC=org"'$cmdhash['ArgumentList'] += 'MAIL_ATTRIBUTE="userPrincipalName"'
# using splatting, run the process
Start-Process @cmdhash


I am not sure that your /CONFIGFILE= is right though. /CONFIGFILE doesn't seem to be an msiexec option. Perhaps you should skip the leading / for that? If that slash should be stripped the command would look like this.

$cmdhash=@{}$cmdhash['FilePath']    = 'C:\Windows\System32\msiexec.exe'
$cmdhash['Wait'] =$true
$cmdhash['NoNewWindow'] =$true
$cmdhash['ArgumentList']=@()$cmdhash['ArgumentList'] += '/qb'
$cmdhash['ArgumentList'] += '/i ps-pulse-win-5.2r5.1-b897-64bitinstaller.msi'$cmdhash['ArgumentList'] += 'CONFIGFILE="ALS GSLB.jnprpreconfig'

Start-Process @cmdhash

• Thanks - once it was broken out into the parts, it worked. Sometimes I hate Powershell ;) – dragonspeed Nov 24 '16 at 17:45
• FWIW breaking it out was probably not the fix. With MSIEXEC Slashed arguments are passed to the MSIEXEC engine and non-slashed arguments are passed to the MSI package. So your extraneous slash was sending the argument to the wrong place. – Clayton Nov 28 '16 at 14:44