In this Azure tutorial, we will discuss how to fix the error. No match was found for the specified search criteria and module name ‘MSOnline’. which comes up while trying to install the MSOnline module in PowerShell in Azure
Table of Contents
No match was found for the specified search criteria and module name ‘MSOnline’
I recently tried installing the MSOnline module in PowerShell ISE and got the above error. I was executing the below cmdlet to install the MSOnline.
PS C:\windows\system32> Install-Module -Name MSOnline
You can see below what was the exact issue that is highlighted in red color.
The exact error that occurred was as mentioned below.
PackageManagement\Install-Package: No match was found for the specified search criteria and module name ‘MSOnline’. Try Get-PSRepository to see all available registered module repositories.
At C:\Program Files\WindowsPowerShell\Modules\PowerShellGet\1.0.0.1\PSModule.psm1:1809 char:21
- … $null = PackageManagement\Install-Package @PSBoundParameters
~~~~~~~~~~~~- CategoryInfo : ObjectNotFound: (Microsoft. Power….InstallPackage: InstallPackage) [Install-Package], Exception
- FullyQualifiedErrorId: NoMatchFoundForCriteria, Microsoft.PowerShell.PackageManagement.Cmdlets.InstallPackage
Packagemanagement\install-package : no match was found for the specified search criteria and module name ‘msonline’. [Solution]
Solution-1
Now, to fix the above issue, you can follow the article on Install-packageprovider no match was found for the specified search criteria for the provider ‘nuget’.
This article also fixes the error “Install-packageprovider no match was found for the specified search criteria for the provider ‘nuget’”
Now, once you follow the steps mentioned in the above article, you should be able to install the MSOnline module using the below cmdlet
PS C:\windows\system32> Install-Module -Name MSOnline
You can run the below cmdlet to see all available registered module repositories
PS C:\windows\system32> Get-PSRepository
You can see here
The above steps will fix your issue. If you are still getting the error “No match was found for the specified search criteria and module name ‘MSOnline'” then try out the below steps
Solution-2
- Run the below PowerShell cmdlet to check the repository.
PS C:\WINDOWS\system32> Get-PSRepository
After running the above PowerShell cmdlet, there might be a chance you will get the WARNING: Unable to find module repositories. Run the below PowerShell cmdlet to fix this.
2. Run the below PowerShell cmdlet to reset the repository.
PS C:\WINDOWS\system32> Register-PSRepository -Default
3. Run the below PowerShell cmdlet again to check the repository.
PS C:\WINDOWS\system32> Get-PSRepository
You can see the Output like the below
4. Now Run the Below PowerShell cmdlet to install the “MSOnline” module
PS C:\windows\system32> Install-Module -Name MSOnline
As shown below, click the Yes to All button to confirm the installation.
You can see below that it started installing the MSOnline module without any issues.
You may like the following Azure tutorials:
- Because of protocol error (code 0x112d) the remote session will be disconnected
- Azure.psm1 cannot be loaded because running scripts is disabled on this system
Conclusion
This Azure tutorial discussed how exactly you can fix the error. No match was found for the specified search criteria and module name ‘MSOnline’ and Install-packageprovider no match was found for the specified search criteria for the provider ‘nuget’.
I hope it helped you to fix your issues.
I am Bijay, a Microsoft MVP (10 times) having more than 17 years of experience in the software industry. During my IT career, I got a chance to share my expertise in SharePoint and Microsoft Azure, like Azure VM, Azure Active Directory, Azure PowerShell, etc. I hope you will learn from these Azure tutorials. Read more