Install-Module : A parameter cannot be found that matches parameter name ‘AllowPrerelease’.

Microsoft is releasing new versions of PowerShell modules frequently now. And the real truth is many of the commandlets are having bugs these days than the earlier days (my personal opinion, not based on any statistics). In parallel, new services are getting launched and new modules are coming up to support them. Many times, We are forced to use the pre-release version to see if bug is getting fixed on the upcoming version.

The most common approach is to install the latest version directly from online repository if the client machines has access to internet. And the commandlet to be used is Install-Module with an additional switch -AllowPrerelease. However, Its common to end up with the below error, especially for the newer versions.

Install-Module : A parameter cannot be found that matches parameter name ‘AllowPrerelease’.
At line:1 char:37

  • Install-Module -Name MicrosoftTeams -AllowPrerelease
  • ~~~~
    • CategoryInfo : InvalidArgument: (:) [Install-Module], ParameterBindingException
    • FullyQualifiedErrorId : NamedParameterNotFound,Install-Module

The commandlet is not accepting the switch -AllowPrerelease.

As per the release notes, Minimum PowerShell version is 5.1 and I was running 5.1.17763.1971 on my server, still ended up with this error.

Fix?

Go ahead and Install Powershell 7.x.

You can install pre-release versions through Powershell 7. -PreRelease switch works fine with Powershell 7.

An additional error will come up to include -Force to install a pre-release version. With that, We are good to go !

Leave a Reply