Troubleshooting

Troubleshooting “No match was found for the specified criteria and module name”

This is a post in a series of blog articles about troubleshooting typical error situations in PowerShell cmdlets in the cloud. This time it’s about…

Install-Module

You try to install a Powershell Module, for example MSOnline, AzureAD, AzureADPreview, ExchangeOnlineManagement or some other module from the PowerShell Gallery needed for cloud scripting. And then, you get this error message:

Screenshot with a error message of the PowerShell cmdlet Install-Module

Fun fact: The PSGallery deprecated Transport Layer Security (TLS) versions 1.0 and 1.1 as of April 2020. Here is the announcement on the Microsoft DevBlog post. So you might be blocked because your machine’s security protocol setting is still stuck with version 1.0 or 1.1. So now it’s time to set a better TLS level:

[Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12

After this, try the module installation again. If the error is still there, then we should start reading the error message carefully (you always do, don’t you ? 😉 ) and try getting the cmdlet that is proposed here:

Get-PSRepository

If you get an empty list – or you don’t see the PSGallery in the list of PowerShell module repositories, you should first try to register the PSGallery again. Because without the PSGallery as a repository, the cmdlets Install-Module, Update-Module, or Find-Module cannot work. So next step is to try the repository registration:

Register-PSRepository -Default -Verbose
Screenshot with the PowerShell cmdlet Register-PSRepository

After this, try the module installation again. It should work now.

Leave a Reply

Your email address will not be published. Required fields are marked *