How to install the latest PowerShell module version?

PowerShellMicrosoft TechnologiesSoftware & Coding

Although simply running Install-Module command picks up the latest version of the module, we can still use the -RequiredVersion and -MinimumVersion parameter to install the latest version manually. Below command directly installs the latest available version of the module.

In this example we are using 7Zip4PowerShell module.

Install-Module 7Zip4PowerShell -Scope AllUsers -Force -Verbose

To manually install the latest version of the PowerShell module, there are two methods.

  • Use the -RequiredVersion parameter if you know the latest version of the module.
  • Use the -MinimumVersion parameter if you know the minor version of the module and it will pick up the latest version.


  • Using -RequiredVersion Parameter

This parameter installs the specific version of the module. To installs the latest version, we first need to identify the all available versions and then pick the latest version from it and install it.

We can check all available versions using the Find-Module version.

Find-Module 7zip4PowerShell -AllVersions

Here, we have the latest version 1.13.0 of the module 7Zip4PowerShell and we are going to install it.

Install-Module 7Zip4PowerShell -RequiredVersion 1.13.0 -Scope AllUsers -Force -Verbose
  • If you don't know one of its versions but not the latest version then use -MinimumVersion parameter and it will automatically pick up the latest version.
Install-Module 7Zip4PowerShell -MinimumVersion 1.9.0 -Scope AllUsers -Force -Verbose

The above command will install module version 1.13.0 because it is its latest version.

raja
Published on 18-Mar-2021 07:50:56
Advertisements