Updating PowerShell module fails with “cannot convert value” error

When I was recently using the Exchange Online PowerShell module it repeatedly told me I was using an out-of-date version (albeit I had 2.0.5 and this was the latest non-preview version!) and it was going to be deprecated. The link that MS provided gives you the command to do the update:

Install-Module -Name ExchangeOnlineManagement -RequiredVersion 2.0.6-Preview5 -AllowPrerelease

Running this failed with an error that it `‘Cannot convert value “2.0.6-Preview5” to type “System.Version”.  Error: “Input string was not in a correct format.”

The solution is to update PowerShellGet, close and then open PowerShell, and then re-run the command. To update PowerShellGet:

Install-Module PowerShellGet –Repository PSGallery –Force

For reference, to check the currently installed version of the EOL PS module:

Import-Module ExchangeOnlineManagement; Get-Module ExchangeOnlineManagement

Related Posts

Need IT Help?

If you need assistance please feel free to reach out to us.