How to Install Software in PowerShell

  1. Install Software in PowerShell
  2. Install Software Using the Start-Process Cmdlet in PowerShell
  3. Install Software Silently in PowerShell
How to Install Software in PowerShell

PowerShell scripting language automates multiple Windows operating system tasks and processes. For example, PowerShell can execute various files like installation files with format MSI or .exe.

This article will demonstrate several methods and approaches to installing Windows PowerShell software.

Install Software in PowerShell

The following are the steps to install software using PowerShell:

  • Open your Windows PowerShell terminal.
  • Find the location of the .exe file and change the working directory to this.
  • Then, use the change directory or cd command to change the current working directory of the console.
  • Once we have adjusted our working directory, we may run our executable file by calling it to the command line.

Command:

.\installer_setup.exe;

However, this method’s caveat would be that it will not suffice if we want to pass specific arguments when installing. Before, we had a legacy command called msiexec executed in the command prompt.

The following section will teach us the similar counterpart to msiexec in Windows PowerShell.

Install Software Using the Start-Process Cmdlet in PowerShell

The Start-Process command can run executable files in Windows PowerShell. The PowerShell cmdlet stated above and the -FilePath parameter takes the complete path of the .exe installation file.

Moreover, the -ArgumentList parameter provides the internal parameters used by the executable file when the installation process starts in Windows PowerShell. Lastly, the -PassThru parameter is used to verify that the command worked as we intended.

Suppose we want to open an executable file named installer_setup.exe.

Example:

Start-Process -Wait -FilePath '.\installer_setup.exe' -ArgumentList '/s' -PassThru

Once the above script is executed, Windows PowerShell will run the defined executable file.

Install Software Silently in PowerShell

Running installation software in Windows PowerShell takes advantage of the msiexec legacy command that we usually use to run installation software in the command prompt.

To execute the installation software silently, we must use specific msiexec command parameters and pass them to the -ArgumentList parameter in Windows PowerShell.

Below are the parameters and descriptions we need to run to install software silently in Windows PowerShell.

  • /s: runs the installation in silent mode.
  • /v: passes command-line values and public properties options through the Msiexec.exe facility.
  • /q: sets user interface level.
  • n: interface level of the /q parameter; will run the installation with no graphical user interface.

Combining all of the parameters above in one command is how the PowerShell script should look.

Start-Process -Wait -FilePath '.\setup.exe' -ArgumentList '/s /v/qn' -PassThru

The installation should run in silent mode with no window or wizard prompts by executing the code snippet above.

It is worth noting that both the /v and /qn parameters are executed with no spaces between them because the /qn parameter is executed as a subfunction of the /v parameter.

The above parameters are not the only existing parameters under the msiexec command. You may run the msiexec command in PowerShell for more info.

Marion Paul Kenneth Mendoza avatar Marion Paul Kenneth Mendoza avatar

Marion specializes in anything Microsoft-related and always tries to work and apply code in an IT infrastructure.

LinkedIn