Powershell Command to install a MSI with a MST

rated by 0 users
This post has 6 Replies | 4 Followers

Not Ranked
Posts 2
Turn_360 Posted: 04-26-2012 9:07 AM

I am able to use the following commandline to install a MSI with the arguments I want

  • {Start-Process -FilePath "msiexec.exe" -ArgumentList "/i TEST.msi /qb" -Wait -Passthru}

I am unable to get the commandline to work when I add an MST

  • {Start-Process -FilePath "msiexec.exe" -ArgumentList "/i TEST.msi TRANSFORMS=`"TEST.mst`" /qb" -Wait -Passthru}

I have tried a few different options like /T instead of Transforms.  The PS1 is in the same folder as the MSI /MST.   What is the proper way to install a MSI with an MST using Powershell?

 

 

Top 10 Contributor
Posts 640

So, I'm not an MsiExec expert by any stretch. It looks to me like you've got the syntax right - escaped the internal double quotes and all - although I can't validate whether or not the syntax would actually work.

If you just ran the Msiexec command in Cmd.exe, would it work? Have you had the .PS1 explicitly change to the folder (using CD command) where it and the MSI/MST are located?

Not Ranked
Posts 2

Correct if I create a .CMD file, this command will work:

  • msiexec.exe /i "TEST.msi" TRANSFORMS="TEST.mst" /qb!

 

Top 10 Contributor
Posts 640

And you're having the PS1 explicitly change into the proper folder, to make sure it's the "working folder," when it runs?

Beyond that I'm afraid I don't have any suggestions for you - I'm not able to test this in my own VMs to see what I can get it to do. 

I will suggest this: The PowerShell Community Extensions (PSCX) include a little command-line utility. You feed it your command, and it tells you how PowerShell is interpreting that and feeding it to Cmd.exe. That might help you see what's up.

You might also try not using Start-Process, if you don't have to. Try just running the command in PowerShell as-is. That'll help you see if it's PowerShell somehow flubbing the command, or if it's Start-Process that's doing so. If it's Start-Process, consider putting the command into a BAT file, and using Start-Process to run the BAT file. A lot of layers, but it's essentially what's happening under the hood anyway and it'd help minimize PowerShell's parsing snafus, if that's contributing to the problem.

Top 25 Contributor
Posts 287
Top Contributor

You have to put commas between the arguments.

  • {Start-Process -FilePath "msiexec.exe" -ArgumentList /i, TEST.msi, TRANSFORMS=TEST.mst, /qb -Wait -Passthru}
    Not Ranked
    Posts 5

    Take a look at the PowerShell Application Deployment Toolkit. It provides a function to install an MSI with support for Transforms:

    http://PSAppDeployToolkit.codeplex.com

    Not Ranked
    Posts 1

    Spent a bit of time trying to figure out how to pass variables to the arguments list which contain spaces in MST and MSI name, came up with something that now works for me:

    $DFolder = "c:\tmp" 

    $MSIName = "Test AppName Version 1.msi"

    $MSTName = "Test AppName Version 1.mst"

    $Arguments = "/i `"$DFolder\$MSIName`" TRANSFORMS=`"$DFolder\$MSTName`" ALLUSERS=1 /qn"

    start-process msiexec -arg $arguments -Wait

     

    Page 1 of 1 (7 items) | RSS
    Copyright 2012 PowerShell.com. All rights reserved.