1

in my powershell script, I need to run msiexec and pass few parameters to initialize it. The problem is, that if a parameter contains space character " ", powershell doesn't execute msiexec correctly. For example the command:

msiexec /i .\Setup.msi ConnectionString="Initial Catalog=something;Integrated Security=True;Pooling=False"

The parameter ConnectionString contains spaces, and this causes that msiexec is not executed correctly, I get msiexec error code 1639 - Invalid command line argument. If I remove spaces from from connection string, msiexec is executed correctly.

Do anybody have an idea how to solve it?

BЈовић
  • 62,405
  • 41
  • 173
  • 273
Mikee
  • 626
  • 1
  • 10
  • 23
  • could you try this: msiexec /i .\Setup.msi 'ConnectionString="Initial Catalog=something;Integrated Security=True;Pooling=False"' – CB. Jan 18 '12 at 12:34
  • I try it, unfortunatelly, it doesn't work, but thanks for idea. – Mikee Jan 18 '12 at 12:42

2 Answers2

3

Try in this way:

Start-Process -FilePath msiexec -ArgumentList / /i, .\Setup.msi, "ConnectionString='Initial Catalog=something;Integrated Security=True;Pooling=False'"  -Wait 
CB.
  • 58,865
  • 9
  • 159
  • 159
0

Try single quoting it like this:

& msiexec.exe /i .\Setup.msi ConnectionString='"Initial Catalog=something;Integrated Security=True;Pooling=False"'
Andy Arismendi
  • 50,577
  • 16
  • 107
  • 124