Can't install Exchange Online PowerShell V2 module

Ali Price 1 Reputation point

I'm trying to enable modern authentication for an O365 tenant, and then instructions say to import the Exchange Online Management module. I don't have that module, so those same instructions say to install it by using

Install-Module -Name ExchangeOnlineManagement -RequiredVersion 2.0.5

But then I get this error

WARNING: Unable to resolve package source ''.
PackageManagement\Install-Package : No match was found for the specified search criteria and module name
'ExchangeOnlineManagement'. Try Get-PSRepository to see all available registered module repositories.
At C:\Program Files\WindowsPowerShell\Modules\PowerShellGet\\PSModule.psm1:1772 char:21
+ ...          $null = PackageManagement\Install-Package @PSBoundParameters
+                      ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : ObjectNotFound: (Microsoft.Power....InstallPackage:InstallPackage) [Install-Package], E
    + FullyQualifiedErrorId : NoMatchFoundForCriteria,Microsoft.PowerShell.PackageManagement.Cmdlets.InstallPackage

Just in case I did also run this to check


And the result was

Name                      InstallationPolicy   SourceLocation
----                      ------------------   --------------
PSGallery                 Untrusted  

And that seems correct. So does anybody know why it's not working.


Windows Server PowerShell
Windows Server PowerShell
Windows Server: A family of Microsoft server operating systems that support enterprise-level management, data storage, applications, and communications.PowerShell: A family of Microsoft task automation and configuration management frameworks consisting of a command-line shell and associated scripting language.
5,414 questions
0 comments No comments
{count} votes

2 answers

Sort by: Most helpful
  1. Rich Matheisen 45,186 Reputation points

    You may have a problem with TLS: powershell-fix-warning-unable-to-resolve-package-source-https-www-powershellgallery-com-api-v2

    Does this work, or do you get an error?

    Invoke-WebRequest ''
    0 comments No comments

  2. Ali Price 1 Reputation point

    You are correct it was a TLS issue in the end. The solution was to force a higher version of TLS using:

    [Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12
    0 comments No comments