I am trying to perform a silent install of IBM Rational Doors 9.7 as explained here.
I want to perform the install with Powershell. I am constructing the arguments to Start-Process to run the installer like this:
$doors97installArgs = '/s /v"/l*v"install.log" /qn INSTALLDIR="C:\Program Files\IBM\Rational\DOORS\9.7.2.3\" CLIENTDATA="36990@<redacted>" LAPAGREE="Yes" TLLICENSESERVER="27200@<redacted>" -wait -verb open'
For Start-Process I am using this:
Start-Process -WorkingDirectory $doors97location -FilePath $doors97setupFullPath -ArgumentList $doors97installArgs
The values in $doors97location and $doors97setupFullPath evaluate correctly.
When Start-Process runs it immediately exits with no error message. What am I doing wrong?
There are two problems with your command:
You mistakenly included -wait
and -verb open
inside the argument-list string passed to Start-Process
.
-Verb Open
is redundant, as it is implied. (-Verb
is typically only used with RunAs
, to request execution _with elevation).The argument-list string is broken in that the embedded "
chars. inside /v"..."
aren't escaped.
However, since your intent is to run synchronously (Start-Process -Wait
), for simplicity I suggest calling via cmd /c
instead, which is implicitly synchronous while giving you the same control over the quoting on the resulting process command lines as with Start-Process
; additionally, the installer process' exit code will be reflected in the automatic $LASTEXITCODE
variable afterwards.
Based on the docs you link to, try the following (using an expandable here-string to make use of embedded quotes easier):
# Call the installer synchronously.
#
cmd /c @"
cd /d "$doors97location"
"$doors97setupFullPath" /s /v"/l*v\"install.log\" /qn INSTALLDIR=\"C:\Program Files\IBM\Rational\DOORS\9.7.2.3\" CLIENTDATA=\"36990@<redacted>\" LAPAGREE=\"Yes\" TLLICENSESERVER=\"27200@<redacted>\""
"@ # NOTE: This closing delimiter must be *at the very start* of the line.
After this call, $LASTEXITCODE
contains the installer's exit code.