Unable to register PSGallery

Welcome Forums General PowerShell Q&A Unable to register PSGallery

This topic contains 2 replies, has 2 voices, and was last updated by

 
Participant
10 months ago.

  • Author
    Posts
  • #99673

    Participant
    Points: 1
    Rank: Member

    Had some problems being unable to resolve psgallery due to proxy, unregistered psgallery and trying to register it again:

    PS C:\> Register-PSRepository -Default -Verbose
    VERBOSE: Performing the operation "Register Module Repository." on target "Module Repository 'PSGallery' () in provider 'PowerShellGet'.".

    that seems to have no effect:

    PS C:\> Get-PSRepository
    WARNING: Unable to find module repositories.

    Registering internal repositories works fine:

    PS C:\> Register-PSRepository -Name "test" -SourceLocation "http://artifactory.company.net/artifactory/api/nuget/psgallery" -Verbose
    VERBOSE: Performing the operation "Register Module Repository." on target "Module Repository 'test' (http://artifactory.company.net/artifactory/api/nuget/psgallery) in provider 'PowerShellGet'.".
    VERBOSE: The specified PackageManagement provider name 'NuGet'.
    VERBOSE: Successfully registered the repository 'test' with source location 'http://artifactory.company.net/artifactory/api/nuget/psgallery'.
    VERBOSE: Repository details, Name = 'test', Location = 'http://artifactory.company.net/artifactory/api/nuget/psgallery'; IsTrusted = 'False'; IsRegistered = 'True'.
    PS C:\> Get-PSRepository
    
    Name                      InstallationPolicy   SourceLocation
    ----                      ------------------   --------------
    test                      Untrusted            http://artifactory.company.net/artifactory/api/nuget/psgallery
  • #99676

    Participant
    Points: 398
    Helping Hand
    Rank: Contributor

    A bit of a search turned up this:

    http://troyparsons.com/blog/2016/07/setting-the-proxy-used-for-powershell-gallery/

    Looks like you just gotta define the default proxy settings for WebRequest. 🙂

    • #99682

      Participant
      Points: 1
      Rank: Member

      Thanks that was what I was missing, I've also had to provide credentials:

      [System.Net.WebRequest]::DefaultWebProxy.Credentials = [System.Net.CredentialCache]::DefaultNetworkCredentials

      and the PSRepository registered successfully, still I think

      Register-PSRepository -Default

      could be more helpful and throw some kind of error when it is unable to register.

The topic ‘Unable to register PSGallery’ is closed to new replies.

denizli escort samsun escort muğla escort ataşehir escort kuşadası escort