PowershellGet - Find-Module

On Windows 8.1, Find-Module doesn’t pull modules from the Powershell Module gallery. I was manually able to download and install NuGet in the correct folder, but now I am stuck again. Does find-module work behind a proxy?

Exception calling “FindPackage” with “2” argument(s): “An error occurred while loading packages from
https://go.microsoft.com/fwlink/?LinkID=397631&clcid=0x409’: Expected an absolute, well formed http URL without a
query or fragment.
Parameter name: serviceRoot”
At C:\windows\system32\windowspowershell\v1.0\Modules\PowerShellGet\SourceTypes\PSGallery\PSGallery.psm1:157 char:9

  •     $packageInfo = [NuGet.PackageRepositoryExtensions]::FindPacka ...
    
  •     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    
    • CategoryInfo : NotSpecified: (:slight_smile: , MethodInvocationException
    • FullyQualifiedErrorId : InvalidOperationException

As the error indicates, you’re not allowed to use a URL that has a ?query in it. This might be something better logged as a bug on Connect.

Thanks for the response.

It is the proxy server at work.

Attach laptop to LAN cable and configure required proxy in IE. Fails

Remove LAN cable and connect to internal wireless which has no proxy. Remove proxy settings in IE. Succeeds.

The reason this is an issue is my main workstation is a Citrix session accessed via a Wyse unit. No wireless. Only wired connection.

Thanks,
Marty

Here’s a trick that may work (it just worked for me!), I previously figured/googled this out when Update-Help didn’t work from behind the work proxy.

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

Then you just run your Install-Module command. Ta-dah

Hello everybody,

I know this is an old thread but I haven’t found any solution to working behind a proxy, so I hope somebody can help. The solution that ambrosis posted doesn’t work for me, because i have to use different credentials for the proxy login. That’s not really a problem as i can just put other credentials in like this:

$webclient = New-Object System.Net.WebClient
$creds = Get-Credential
$webclient.Proxy.Credentials = $creds

This works totally fine for Update-Help, but i just can’t connect through the proxy with Find-Module:

PS C:\Windows\system32> Find-Module -Verbose
VERBOSE: The -Repository parameter was not specified.  PowerShellGet will use all of the registered repositories.
VERBOSE: Getting the provider object for the PackageManagement Provider 'NuGet'.
VERBOSE: The specified Location is 'https://www.powershellgallery.com/api/v2/' and PackageManagementProvider is 'NuGet'.
WARNING: Repository location 'https://www.powershellgallery.com/api/v2/' is not valid for this provider.
WARNING: Unable to resolve module repository 'https://www.powershellgallery.com/api/v2/'.
VERBOSE: Getting the provider object for the PackageManagement Provider 'NuGet'.
VERBOSE: The specified Location is 'http://chocolatey.org/api/v2/' and PackageManagementProvider is 'NuGet'.

Does anybody have an idea how to get the proxy to work?