Compartir a través de


Register-PSRepository

Registers a PowerShell repository.

Sintaxis

NameParameterSet (Es el valor predeterminado).

Register-PSRepository
    [-Name] <String>
    [-SourceLocation] <Uri>
    [-PublishLocation <Uri>]
    [-ScriptSourceLocation <Uri>]
    [-ScriptPublishLocation <Uri>]
    [-Credential <PSCredential>]
    [-InstallationPolicy <String>]
    [-Proxy <Uri>]
    [-ProxyCredential <PSCredential>]
    [-PackageManagementProvider <String>]
    [<CommonParameters>]

PSGalleryParameterSet

Register-PSRepository
    [-Default]
    [-InstallationPolicy <String>]
    [-Proxy <Uri>]
    [-ProxyCredential <PSCredential>]
    [<CommonParameters>]

Description

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.

This is a proxy cmdlet for the Register-PSResourceRepository cmdlet in the Microsoft.PowerShell.PSResourceGet. For more information, see Register-PSResourceRepository.

Ejemplos

Example 1: Register a repository

$parameters = @{
  Name = "myNuGetSource"
  SourceLocation = "https://www.myget.org/F/powershellgetdemo/api/v2"
  PublishLocation = "https://www.myget.org/F/powershellgetdemo/api/v2/Packages"
  InstallationPolicy = 'Trusted'
}
Register-PSRepository @parameters
Get-PSRepository
Name                SourceLocation          OneGetProvider       InstallationPolicy
----                --------------          --------------       ------------------
PSGallery           http://go.micro...      NuGet                Untrusted
myNuGetSource       https://myget.c...      NuGet                Trusted

The first command registers https://www.myget.org/F/powershellgetdemo/ 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 PackageManagementProvider parameter isn't specified, the repository is not explicitly associated with a OneGet package provider, so PowerShellGet polls available package providers and associates it with the NuGet provider.

The second command gets registered repositories and displays the results.

Parámetros

-Credential

The proxy cmdlet ignores this parameter since it's not supported by Register-PSResourceRepository.

Propiedades del parámetro

Tipo:PSCredential
Valor predeterminado:None
Admite caracteres comodín:False
DontShow:False

Conjuntos de parámetros

NameParameterSet
Posición:Named
Mandatory:False
Valor de la canalización:False
Valor de la canalización por nombre de propiedad:True
Valor de los argumentos restantes:False

-Default

Registers PowerShell Gallery as the default repository.

The proxy cmdlet transforms the value of this parameter to the PSGallery parameter of Register-PSResourceRepository.

Propiedades del parámetro

Tipo:SwitchParameter
Valor predeterminado:None
Admite caracteres comodín:False
DontShow:False

Conjuntos de parámetros

PSGalleryParameterSet
Posición:Named
Mandatory:True
Valor de la canalización:False
Valor de la canalización por nombre de propiedad:False
Valor de los argumentos restantes:False

-InstallationPolicy

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.

The proxy cmdlet transforms the value of this parameter to the Trusted parameter of Register-PSResourceRepository.

Propiedades del parámetro

Tipo:String
Valor predeterminado:None
Valores aceptados:Trusted, Untrusted
Admite caracteres comodín:False
DontShow:False

Conjuntos de parámetros

(All)
Posición:Named
Mandatory:False
Valor de la canalización:False
Valor de la canalización por nombre de propiedad:False
Valor de los argumentos restantes:False

-Name

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.

Propiedades del parámetro

Tipo:String
Valor predeterminado:None
Admite caracteres comodín:False
DontShow:False

Conjuntos de parámetros

NameParameterSet
Posición:0
Mandatory:True
Valor de la canalización:False
Valor de la canalización por nombre de propiedad:False
Valor de los argumentos restantes:False

-PackageManagementProvider

The proxy cmdlet ignores this parameter since it's not supported by Register-PSResourceRepository.

Propiedades del parámetro

Tipo:String
Valor predeterminado:None
Admite caracteres comodín:False
DontShow:False

Conjuntos de parámetros

NameParameterSet
Posición:Named
Mandatory:False
Valor de la canalización:False
Valor de la canalización por nombre de propiedad:False
Valor de los argumentos restantes:False

-Proxy

The proxy cmdlet ignores this parameter since it's not supported by Register-PSResourceRepository.

Propiedades del parámetro

Tipo:Uri
Valor predeterminado:None
Admite caracteres comodín:False
DontShow:False

Conjuntos de parámetros

(All)
Posición:Named
Mandatory:False
Valor de la canalización:False
Valor de la canalización por nombre de propiedad:True
Valor de los argumentos restantes:False

-ProxyCredential

The proxy cmdlet ignores this parameter since it's not supported by Register-PSResourceRepository.

Propiedades del parámetro

Tipo:PSCredential
Valor predeterminado:None
Admite caracteres comodín:False
DontShow:False

Conjuntos de parámetros

(All)
Posición:Named
Mandatory:False
Valor de la canalización:False
Valor de la canalización por nombre de propiedad:True
Valor de los argumentos restantes:False

-PublishLocation

The proxy cmdlet ignores this parameter since it's not supported by Register-PSResourceRepository.

Propiedades del parámetro

Tipo:Uri
Valor predeterminado:None
Admite caracteres comodín:False
DontShow:False

Conjuntos de parámetros

NameParameterSet
Posición:Named
Mandatory:False
Valor de la canalización:False
Valor de la canalización por nombre de propiedad:False
Valor de los argumentos restantes:False

-ScriptPublishLocation

The proxy cmdlet ignores this parameter since it's not supported by Register-PSResourceRepository.

Propiedades del parámetro

Tipo:Uri
Valor predeterminado:None
Admite caracteres comodín:False
DontShow:False

Conjuntos de parámetros

NameParameterSet
Posición:Named
Mandatory:False
Valor de la canalización:False
Valor de la canalización por nombre de propiedad:False
Valor de los argumentos restantes:False

-ScriptSourceLocation

The proxy cmdlet ignores this parameter since it's not supported by Register-PSResourceRepository.

Propiedades del parámetro

Tipo:Uri
Valor predeterminado:None
Admite caracteres comodín:False
DontShow:False

Conjuntos de parámetros

NameParameterSet
Posición:Named
Mandatory:False
Valor de la canalización:False
Valor de la canalización por nombre de propiedad:False
Valor de los argumentos restantes:False

-SourceLocation

Specifies the URI for discovering and installing modules from this repository. A URI can be a NuGet server feed (most common situation), HTTP, HTTPS, FTP or file location.

For example, for NuGet-based repositories, the source location is similar to https://someNuGetUrl.com/api/v2.

The proxy cmdlet maps this parameter to the Uri parameter of Register-PSResourceRepository

Propiedades del parámetro

Tipo:Uri
Valor predeterminado:None
Admite caracteres comodín:False
DontShow:False

Conjuntos de parámetros

NameParameterSet
Posición:1
Mandatory:True
Valor de la canalización:False
Valor de la canalización por nombre de propiedad:False
Valor de los argumentos restantes:False

CommonParameters

This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutBuffer, -OutVariable, -PipelineVariable, -ProgressAction, -Verbose, -WarningAction, and -WarningVariable. For more information, see about_CommonParameters.

Entradas

PSCredential

Uri

Salidas

Object

Notas

The PowerShell Gallery no longer supports Transport Layer Security (TLS) versions 1.0 and 1.1. You must use TLS 1.2 or higher. Use the following command to ensure you are using TLS 1.2:

[Net.ServicePointManager]::SecurityProtocol = [Net.ServicePointManager]::SecurityProtocol -bor [Net.SecurityProtocolType]::Tls12