PowerShell--How to install MSI suffix software in bulk

Source: Internet
Author: User

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 to complete, it has already run the next installation package.

If you are in a batch, we may use Msiexec file.msi/wait. Msiexec can also be used in PowerShell.
Store the installation package paths in the array first:

The code is as follows:

$msi = @ ("C:\file1.msi", "C:\file2.msi", "C:\file2.msi")


Then use the-wait parameter of the start-process to wait until the previous installer has finished running and then start the next one:

The code is as follows:

foreach ($_ in $msi)
{
Start-process-filepath msiexec-argumentlist/i, $_,/qn-wait
}


Another option is to redirect the output to some null, and also to ensure that the program waits for the installation to complete:

The code is as follows:

foreach ($_ in $msi)
{
msiexec/i $_/qn | Out-null
}



Article Source: http://www.pstips.net/install-multiple-msi-using-powershell.html

This article comes from the "Ricky's blog" blog, please be sure to keep this source http://57388.blog.51cto.com/47388/1643886

PowerShell--How to install MSI suffix software in bulk

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.