Back
Featured image of post Install-Module – unable to resolve package source

Install-Module – unable to resolve package source

Most of the time the Windows PowerShell Session is missing support TLS 1.2 in this case

Today a friend asked me for Help: He tried to install the new Exchange Online PowerShell V2 module but the response was Unable to resolve package source https://www.powershellgallery.com/api/v2

`Install-Module` - unable to resolve package source

There are two things you can check first:

  1. Do I need to use a proxy to access the Internet?
  2. Do my PowerShell Session support TLS 1.2?

In case you need a proxy, try this:

# Add Proxy Support
$webclient = (New-Object System.Net.WebClient)
$webclient.Proxy.Credentials = [System.Net.CredentialCache]::DefaultNetworkCredentials

If you want to ensure that your PowerShell Session support TLS 1.2, try this:

# Add TLS 1.2 Support
[Net.ServicePointManager]::SecurityProtocol = 'tls12'

Now you can install the Module:

Install-Module -Name ExchangeOnlineManagement

If this works for you, you might want to add the snippets from above to your PowerShell Profile!

# Create a new Profile (if needed)
if (-not (Test-Path -Path $PROFILE))
{
   Set-Content -Value $null -Path $PROFILE
}

# Now you can edit the Profile (Use the editor of your choice here, just replace ise)
ise $PROFILE