Registers a PowerShell repository.
Register-PSRepository [-InstallationPolicy {Trusted | Untrusted}] [-PackageManagementProvider [<String>]][-PublishLocation [<Uri>]] [-ScriptPublishLocation [<Uri>]] [-ScriptSourceLocation [<Uri>]] -Name* <String>-SourceLocation* <Uri> [<CommonParameters>]

The Register-PSRepository cmdlet registers the default repository for PowerShell modules. After a repository is registered, you can reference it from the Find-Module, Install-Module, and Publish-Module cmdlets. The registered repository becomes the default repository in Find-Module and Install-Module.

Registered repositories are user-specific. They are not registered in a system-wide context.

Each registered repository is associated with a OneGet package provider, which is specified with the PackageManagementProvider parameter. Each OneGet provider is designed to interact with a specific type of repository. For example, the NuGet provider is designed to interact with NuGet-based repositories. If a OneGet provider is not specified during registration, PowerShellGet attempts to find a OneGet provider that can handle the specified source location.

-InstallationPolicy [<String>]

Specifies the installation policy. Valid values are: Trusted, UnTrusted. The default value is UnTrusted.

A repository’s installation policy specifies PowerShell behavior when installing from that repository. When installing modules from an UnTrusted repository, the user is prompted for confirmation.

You can set the InstallationPolicy with the Set-PSRepository cmdlet.

-Name <String>

  • This value is required

Specifies the name of the repository to register. You can use this name to specify the repository in cmdlets such as Find-Module and Install-Module.

-PackageManagementProvider [<String>]

Specifies a OneGet package provider. If you don’t specify a value for this parameter, PowerShellGet polls available package providers and associates this repository with the first package provider that indicates it can handle the repository.

-PublishLocation [<Uri>]

Specifies the URI of the publish location. For example, for NuGet-based repositories, the publish location is similar to

-ScriptPublishLocation [<Uri>]
-ScriptSourceLocation [<Uri>]
-SourceLocation <Uri>

  • This value is required

Specifies the URI for discovering and installing modules from this repository. For example, for NuGet-based repositories, the source location is similar to


This cmdlet supports the common parameters: Verbose, Debug,ErrorAction, ErrorVariable, WarningAction, WarningVariable,OutBuffer, PipelineVariable, and OutVariable.

  1. Register a repository:
    PS C:> Register-PSRepository -Name "myNuGetSource" -SourceLocation "" -PublishLocation "" -InstallationPolicy Trusted
    PS C:> Get-PSRepository
    Name                                     SourceLocation                                     OneGetProvider 
       ----                                     --------------                                     --------------       
       PSGallery                                http://go.micro...                                 NuGet                
       myNuGetSource                            https://myget.c...                                 NuGet                

    The first command registers as a repository for the current user. After myNuGetSource is registered, you can explicitly reference it when searching for, installing, and publishing modules. Because the PackageManamentProvider parameter isn’t specified, the repository is not explicitly associated with a OneGet packkage provider, so PowerShellGet polls available package providers and associates it with the NuGet provider.

    The second command gets registered repositories and displays the results.

Related Links