08 September 2017

Install-Module - unable to resolve package source 'https //www.powershellgallery.com/api/v2/'

Trying to install a PowerShell module behind a proxy?
Chances are you're getting this error:

unable to resolve package source 'https://www.powershellgallery.com/api/v2/'

Turns out it isn't allowed through your proxy server, run this in your PowerShell session and try again:

$webclient=New-Object System.Net.WebClient            
$webclient.Proxy.Credentials = [System.Net.CredentialCache]::DefaultNetworkCredentials

Now every command you run is sent and allowed through the proxy.

10 comments:

  1. Anonymous10/7/18 03:19

    Thank you! This worked for me, even when providing the proxy & credentials wouldn't work.

    ReplyDelete
  2. Anonymous30/8/18 09:20

    OMG you deserve a cookie!!!
    been busting my head with this for a week.....

    ReplyDelete
  3. Anonymous3/10/18 09:58

    Nice one! Saved me a lot of time and hassle thank you for this! :)

    ReplyDelete
  4. Thanks !

    ReplyDelete
  5. thank you man...works like a charm

    ReplyDelete
  6. Anonymous4/1/19 16:59

    Nice one, thanks

    ReplyDelete
  7. Anonymous9/4/19 23:16

    You are simply awesome!! Thank you so much!!

    ReplyDelete
  8. Anonymous10/4/19 16:34

    Awesome, this worked after a lot of research and wrong paths.
    Thank you.
    Ovi

    ReplyDelete