Get PSRepository - PowerShell


Get-PSRepository retrieves information about PowerShell repositories. This command allows you to manage and interact with repositories, such as listing available repositories or retrieving package details.


Get-PSRepository [-Name] <string[]> [-Credential <PSCredential>] [<CommonParameters>]


  • -Name: Specifies the name(s) of the repositories to retrieve information about. If no name is provided, all repositories will be returned.
  • -Credential: Specifies the credentials to use when accessing a private repository.


  1. List all repositories:
  1. Get details of a specific repository:
Get-PSRepository -Name MyRepository
  1. Access a private repository with credentials:
$credential = Get-Credential
Get-PSRepository -Name PrivateRepo -Credential $credential

Common Issues

  • Unable to access a repository: Check if you have the correct permissions or if the repository is offline.
  • Repository not found: Ensure that the repository name specified in the -Name parameter is correct.


Get-PSRepository can be combined with other PowerShell commands for advanced tasks. For example:

  • Install packages from a specific repository:
Get-PSRepository -Name MyRepository | Install-Module -Name MyPackage
  • Create a new repository:
New-PSRepository -Name MyRepository -PublishLocation \\server\share