- Trending Categories
Data Structure
Networking
RDBMS
Operating System
Java
iOS
HTML
CSS
Android
Python
C Programming
C++
C#
MongoDB
MySQL
Javascript
PHP
Physics
Chemistry
Biology
Mathematics
English
Economics
Psychology
Social Studies
Fashion Studies
Legal Studies
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
How to install MSI file using batch file in PowerShell?
Let say we have one MSI file and we need to install the MSI file on the remote computers using PowerShell but that MSI file should be deployed with the Batch file and should be executed using PowerShell.
In this example, we have a 7-zip MSI file and batch file we will first write the installation instructions as shown below.
msiexec /i "C:\temp\7z1900-x64.msi" /quiet
We have the installation MSI package located at the C:\temp location. We will save the above instruction inside the 7ZipInstaller.bat file.
Now we need to call the batch file as shown below. −Wait will wait for the batch file to execute first and then moves to the next instruction if any and −NoNewWindow will
Start-Process C:\Temp\7zipInstaller.bat -Wait -NoNewWindow
Once you run the above command, it will install 7zip at the location specified. You can directly pass these instructions inside the Start-Process to execute MSI but if we need to execute the batch file then this is a good way because we can call this batch file remotely as well. The below command is for the remote computer.
Invoke-Command -ComputerName TestMachine1, TestMachine2 -ScriptBlock{ Start-Process C:\Temp\7zipInstaller.bat -Wait -NoNewWindow }
This command will run on the computers Testmachine1 and Testmachine2. Make sure you copy the MSI package to the remote location before running this command.
- Related Articles
- How to install the MSI file using PowerShell?
- How to install MSI file to the custom directory using PowerShell?
- How to install the MSI package using PowerShell DSC?
- How to convert JSON file to CSV file using PowerShell?
- How to search in the file using PowerShell?
- How to uninstall the MSI package using PowerShell?
- How to edit the CSV file using PowerShell?
- How to mount the ISO file using PowerShell?
- How to dismount the ISO file using PowerShell?
- How to get the file extension using PowerShell?
- How to retrieve CSV file headers using PowerShell?
- How to create a temporary file using PowerShell?
- How to convert JSON to CSV file using PowerShell?
- How to delete all the file contents using PowerShell?
- How to read the windows host file using PowerShell?
