Set-PSRepository

Sets values for a registered repository.

语法

Default (默认值)

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

说明

The Set-PSRepository cmdlet sets values for a registered module repository. The settings are persistent for the current user and apply to all versions of PowerShell installed for that user.

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

示例

Example 1: Set the installation policy for a repository

Set-PSRepository -Name "myInternalSource" -InstallationPolicy Trusted

This command sets the installation policy for the myInternalSource repository to Trusted, so that you are not prompted before installing modules from that source.

Example 2: Set the source and publish locations for a repository

Set-PSRepository -Name "myInternalSource" -SourceLocation 'https://someNuGetUrl.com/api/v2' -PublishLocation 'https://someNuGetUrl.com/api/v2/packages'

This command sets the source ___location and publish ___location for myInternalSource to the specified URIs.

参数

-Credential

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

参数属性

类型:PSCredential
默认值:None
支持通配符:False
不显示:False

参数集

(All)
Position:Named
必需:False
来自管道的值:False
来自管道的值(按属性名称):True
来自剩余参数的值:False

-InstallationPolicy

Specifies the installation policy. Valid values are: Trusted, Untrusted.

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

参数属性

类型:String
默认值:None
接受的值:Trusted, Untrusted
支持通配符:False
不显示:False

参数集

(All)
Position:Named
必需:False
来自管道的值:False
来自管道的值(按属性名称):False
来自剩余参数的值:False

-Name

Specifies the name of the repository.

参数属性

类型:String
默认值:None
支持通配符:False
不显示:False

参数集

(All)
Position:0
必需:True
来自管道的值:False
来自管道的值(按属性名称):True
来自剩余参数的值:False

-PackageManagementProvider

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

参数属性

类型:String
默认值:None
支持通配符:False
不显示:False

参数集

(All)
Position:Named
必需:False
来自管道的值:False
来自管道的值(按属性名称):False
来自剩余参数的值:False

-Proxy

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

参数属性

类型:Uri
默认值:None
支持通配符:False
不显示:False

参数集

(All)
Position:Named
必需:False
来自管道的值:False
来自管道的值(按属性名称):True
来自剩余参数的值:False

-ProxyCredential

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

参数属性

类型:PSCredential
默认值:None
支持通配符:False
不显示:False

参数集

(All)
Position:Named
必需:False
来自管道的值:False
来自管道的值(按属性名称):True
来自剩余参数的值:False

-PublishLocation

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

参数属性

类型:Uri
默认值:None
支持通配符:False
不显示:False

参数集

(All)
Position:Named
必需:False
来自管道的值:False
来自管道的值(按属性名称):False
来自剩余参数的值:False

-ScriptPublishLocation

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

参数属性

类型:Uri
默认值:None
支持通配符:False
不显示:False

参数集

(All)
Position:Named
必需:False
来自管道的值:False
来自管道的值(按属性名称):False
来自剩余参数的值:False

-ScriptSourceLocation

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

参数属性

类型:Uri
默认值:None
支持通配符:False
不显示:False

参数集

(All)
Position:Named
必需:False
来自管道的值:False
来自管道的值(按属性名称):False
来自剩余参数的值:False

-SourceLocation

Specifies the URI for discovering and installing modules from this repository. 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 Set-PSResourceRepository.

参数属性

类型:Uri
默认值:None
支持通配符:False
不显示:False

参数集

(All)
Position:1
必需:False
来自管道的值:False
来自管道的值(按属性名称):False
来自剩余参数的值: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.

输入

String

PSCredential

Uri

输出

Object

备注

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