PowerShell Import-Module Error – Cannot Convert Value to System.Version

powershell

I'm trying to install a preview version of the MicrosoftTeams PowerShell module using the following command:

Install-Module -Name MicrosoftTeams -RequiredVersion 3.0.1-preview -AllowPrerelease

Unfortunately I'm getting an error:

`'Cannot convert value "3.0.1-preview" to type "System.Version"'

I tried updating PowerShell, and via Windows Terminal, but received the same error message.

Best Answer

For those experiencing this issue, I solved it by updating my version of PowerShellGet in PowerShell.

Install-Module PowerShellGet –Repository PSGallery –Force