Jump to content


Sign in to follow this  
king13p

Start-Process MSIEXEC

Recommended Posts

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


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
Reply to this topic...

×   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...
Sign in to follow this  

×
×
  • Create New...