Proxy Issues with Install Module

J1raya picture J1raya · Feb 15, 2017 · Viewed 17.5k times · Source

Running the following setup:

  • Server 2012 R2
  • PSVersion: 4.0
  • WSManStackVersion: 3.0
  • Git version 2.11.1
  • Package Management Preview - x64: 10.0.10586.117
  • SharpZipLib: 0.86.0
  • NuGet: 2.8.5.208

Trying to install the posh-git module gives:

PowerShellGet\Install-Module posh-git -Scope CurrentUser

But getting

PackageManagement\Install-Package : No match was found for the specified search criteria and module name 'posh-git'.

When trying Get-PackageSource and Get-PSRepository I get

WARNING: Unable to find package sources

and

WARNING: Unable to find module repositories.

I'm sitting behind a TMG proxy and tried using the -Proxy switch and setting setting winttp proxy with no luck.

Answer

J1raya picture J1raya · Feb 23, 2017

A per Keith Hill's suggestion, adding the PowerShellGallery repo manually worked:

Register-PSRepository -Name PSGallery -SourceLocation https://www.powershellgallery.com/api/v2

I had trouble getting this working with the -proxy switch, so I set the proxy via netsh which did the trick:

netsh winhttp set proxy proxy-server="http=myproxy:8080"