If you want to install more than one MSI package, you can not use Invoke-item, otherwise PowerShell will not wait for the previous installation package installed, you have run the next installation package.
If in batch processing, we may use Msiexec file.msi/wait. PowerShell can also be used in the MSIEXEC.
Store these package paths in the array first:
Copy Code code as follows:
$msi = @ ("C:\file1.msi", "C:\file2.msi", "C:\file2.msi")
Then use the start-process-wait parameter and wait until the previous installer finishes, and then start the next one:
Copy Code code as follows:
foreach ($_ in $msi)
{
Start-process-filepath msiexec-argumentlist/i, $_,/qn-wait
}
Another option is to redirect the output to some null and ensure that the program waits for the installation to complete:
Copy Code code as follows:
foreach ($_ in $msi)
{
msiexec/i $_/qn | Out-null
}
Article Source: http://www.pstips.net/install-multiple-msi-using-powershell.html