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 'https://www.powershellgallery.com/api/v2/'
This browser is no longer supported.
Upgrade to Microsoft Edge to take advantage of the latest features, security updates, and technical support.
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 'https://www.powershellgallery.com/api/v2'.
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\1.0.0.1\PSModule.psm1:1772 char:21
+ ... $null = PackageManagement\Install-Package @PSBoundParameters
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : ObjectNotFound: (Microsoft.Power....InstallPackage:InstallPackage) [Install-Package], E
ception
+ FullyQualifiedErrorId : NoMatchFoundForCriteria,Microsoft.PowerShell.PackageManagement.Cmdlets.InstallPackage
Just in case I did also run this to check
Get-PSRepository
And the result was
Name InstallationPolicy SourceLocation
---- ------------------ --------------
PSGallery Untrusted https://www.powershellgallery.com/api/v2
And that seems correct. So does anybody know why it's not working.
Thanks!
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 'https://www.powershellgallery.com/api/v2/'
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