Jump to content


  • 0
king13p

Start-Process MSIEXEC

Question

Hello, I'm working on a Powershell script to install Autodesk products. 

I'm having issues with a step and hopefully someone can help. 

I've tried this many different ways and keep running into errors.

Using double quotes

(Start-Process "msiexec.exe" -ArgumentList ""/i $dirFiles\ABDS2017\Img\x64\RVT\RVT.msi INSTALLDIR="C:\Program Files\Autodesk\" ADSK_SETUP_EXE=1 /qb!"" -NoNewWindow -Wait -PassThru).ExitCode

Error Cannot validate argument on parameter 'ArgumentList' Argument is null or empty.

Using a variable to define InstallDir

        $RevitInstallDir = "C:\Program Files\Autodesk\"
        (Start-Process "msiexec.exe" -ArgumentList "/i $dirFiles\ABDS2017\Img\x64\RVT\RVT.msi INSTALLDIR=$RevitInstallDir ADSK_SETUP_EXE=1 /qb!" -NoNewWindow -Wait -PassThru).ExitCode

Doing this I get the msiexec /option Required Parameter error.

Tried this also, Single Quotes with Quotes on Path

(Start-Process "msiexec.exe" -ArgumentList "/i $dirFiles\ABDS2017\Img\x64\RVT\RVT.msi INSTALLDIR="C:\Program Files\Autodesk\" ADSK_SETUP_EXE=1 /qb!" -NoNewWindow -Wait -PassThru).ExitCode

I receive A positional parameter cannot be found that accepts argument C:\Program

Using single quotes on InstallDir

(Start-Process "msiexec.exe" -ArgumentList "/i $dirFiles\ABDS2017\Img\x64\RVT\RVT.msi INSTALLDIR='C:\Program Files\Autodesk\' ADSK_SETUP_EXE=1 /qb!" -NoNewWindow -Wait -PassThru).ExitCode

Doing this I get the msiexec /option Required Parameter error.

Using single quotes on the outside

(Start-Process "msiexec.exe" -ArgumentList '/i $dirFiles\ABDS2017\Img\x64\RVT\RVT.msi INSTALLDIR="C:\Program Files\Autodesk\" ADSK_SETUP_EXE=1 /qb!' -NoNewWindow -Wait -PassThru).ExitCode

If I do this, it prevents the $dirFiles variable from working. 

 

The reason I'm using Start-Process is because I have many installers one after the other and I want one installer to wait till the one before it finishes. Any help would be appreciated! Thanks

Share this post


Link to post
Share on other sites

1 answer to this question

Recommended Posts

  • 0

I know this is really old but i thought i'd get this anyway.

I like to split things up (makes things easier to write and troubleshoot)
Also use arrays for arguments to msiexec.so, for your install line--

$RevitInstallDir = "$env:ProgramFiles\Autodesk\"
$msifile = "$dirFiles\ABDS2017\Img\x64\RVT\RVT.msi"
$installdirargs = "INSTALLDIR" + "$RevitInstallDir"
$autodeskargs = @(
	"/i"
	"`"$msifile"`"
	"`"installdiragrs`""
	"ADSK_SETP_EXE=1"
	"/qb!"
)

$installcommand = start-process msiexec.exe -ArgumentList $autodeskargs -wait -PassThru

#to get the exitcode do --- $installcommand.ExitCode

 

Share this post


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Answer this question...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...


×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.