다음을 통해 공유


Set-PSResourceRepository

Sets information for a registered repository.

구문

NameParameterSet (기본값)

Set-PSResourceRepository
    [-Name] <String>
    [-Uri <String>]
    [-Trusted]
    [-Priority <Int32>]
    [-ApiVersion <APIVersion>]
    [-CredentialInfo <PSCredentialInfo>]
    [-PassThru]
    [-WhatIf]
    [-Confirm]
    [<CommonParameters>]

RepositoriesParameterSet

Set-PSResourceRepository
    -Repository <Hashtable[]>
    [-PassThru]
    [-WhatIf]
    [-Confirm]
    [<CommonParameters>]

Description

The Set-PSResourceRepository cmdlet sets information for a registered repository.

예제

Example 1

In this example, the Uri for the PoshTestGallery repository has been registered. The Set-PSResourceRepository cmdlet is used to change the Uri to a local path. The PassThru parameter allows you to see the changed repository.

Get-PSResourceRepository -Name "PoshTestGallery"
Name             Uri                                          Trusted   Priority
----             ---                                          -------   --------
PoshTestGallery  https://www.poshtestgallery.com/api/v2         False         50
Set-PSResourceRepository -Name "PoshTestGallery" -Uri "c:/code/testdir" -PassThru
Name             Uri                                          Trusted   Priority
----             ---                                          -------   --------
PoshTestGallery  file:///c:/code/testdir                        False         50

Example 2

This example changes the Priority and Trusted values of the repository.

Note

The Uri value of the default PSGallery repository can't be changed.

Get-PSResourceRepository -Name "PSGallery"
Name             Uri                                          Trusted   Priority
----             ---                                          -------   --------
PSGallery        https://www.powershellgallery.com/api/v2       False         50
Set-PSResourceRepository -Name "PSGallery" -Priority 25 -Trusted -PassThru
Name             Uri                                          Trusted   Priority
----             ---                                          -------   --------
PSGallery        https://www.powershellgallery.com/api/v2        True         25

Example 3

This example uses the Repository parameter to change values for multiple repositories. The parameter takes an array of hashtables. Each hashtable contains information the repository being updated.

Get-PSResourceRepository
Name             Uri                                          Trusted   Priority
----             ---                                          -------   --------
PSGallery        https://www.powershellgallery.com/api/v2       False         50
PoshTestGallery  https://www.poshtestgallery.com/api/v2         False         50
$arrayOfHashtables = @{Name = "PSGallery"; Trusted = $True},
                     @{Name = "PoshTestGallery"; Uri = "c:/code/testdir"}
Set-PSResourceRepository -Repository $arrayOfHashtables -PassThru
Name             Uri                                          Trusted   Priority
----             ---                                          -------   --------
PSGallery        https://www.powershellgallery.com/api/v2        True         50
PoshTestGallery  file:///c:/code/testdir                        False         50

Example 4

This example updates a repository with credential information to be retrieved from a registered Microsoft.PowerShell.SecretManagement vault. You must have the Microsoft.PowerShell.SecretManagement module install and have a registered vault containing the stored secret. The format of the secret must match the requirements of the repository.

$parameters = @{
  Name = "PoshTestGallery"
  Uri = "c:/code/testdir"
  CredentialInfo = [Microsoft.PowerShell.PowerShellGet.UtilClasses.PSCredentialInfo]::new(
    'SecretStore', 'TestSecret')
}
Set-PSResourceRepository @parameters -PassThru |
    Select-Object * -ExpandProperty CredentialInfo
Name           : PoshTestGallery
Uri            : file:///c:/code/testdir
Trusted        : False
Priority       : 50
CredentialInfo : Microsoft.PowerShell.PowerShellGet.UtilClasses.PSCredentialInfo
VaultName      : SecretStore
SecretName     : TestSecret
Credential     :

매개 변수

-ApiVersion

Specifies the API version used by the repository. Valid values are:

  • v2 - uses the NuGet V2 API
  • v3 - uses the NuGet V3 API
  • ContainerRegistry - used for Azure Container Registry
  • local - use this for file system based repositories
  • nugetServer - use this for NuGet.Server based repositories

The Register-PSResourceRepository cmdlet should automatically detect the API version. This parameter allows you to change the API version after you have registered a repository.

매개 변수 속성

형식:Microsoft.PowerShell.PSResourceGet.UtilClasses.PSRepositoryInfo+APIVersion
Default value:None
허용되는 값:V2, V3, Local, NugetServer, ContainerRegistry
와일드카드 지원:False
DontShow:False

매개 변수 집합

NameParameterSet
Position:Named
필수:False
파이프라인의 값:False
속성 이름별 파이프라인의 값:False
나머지 인수의 값:False

-Confirm

Prompts you for confirmation before running the cmdlet.

매개 변수 속성

형식:SwitchParameter
Default value:False
와일드카드 지원:False
DontShow:False
별칭:cf

매개 변수 집합

(All)
Position:Named
필수:False
파이프라인의 값:False
속성 이름별 파이프라인의 값:False
나머지 인수의 값:False

-CredentialInfo

A PSCredentialInfo object that includes the name of a vault and a secret that's stored in a Microsoft.PowerShell.SecretManagement store.

매개 변수 속성

형식:Microsoft.PowerShell.PSResourceGet.UtilClasses.PSCredentialInfo
Default value:None
와일드카드 지원:False
DontShow:False

매개 변수 집합

NameParameterSet
Position:Named
필수:False
파이프라인의 값:False
속성 이름별 파이프라인의 값:False
나머지 인수의 값:False

-Name

Specifies the name of the repository to be modified.

Note

The Uri value of the default PSGallery repository can't be changed.

매개 변수 속성

형식:String
Default value:None
와일드카드 지원:False
DontShow:False

매개 변수 집합

NameParameterSet
Position:0
필수:True
파이프라인의 값:True
속성 이름별 파이프라인의 값:True
나머지 인수의 값:False

-PassThru

When specified, displays the successfully registered repository and its information.

매개 변수 속성

형식:SwitchParameter
Default value:False
와일드카드 지원:False
DontShow:False

매개 변수 집합

(All)
Position:Named
필수:False
파이프라인의 값:False
속성 이름별 파이프라인의 값:False
나머지 인수의 값:False

-Priority

Specifies the priority ranking of the repository. Valid priority values range from 0 to 100. Lower values have a higher priority ranking. The default value is 50.

Repositories are sorted by priority then by name. When searching for resources across multiple repositories, the PSResourceGet cmdlets search the repositories using this sort order and return the first match found.

매개 변수 속성

형식:Int32
Default value:50
와일드카드 지원:False
DontShow:False

매개 변수 집합

NameParameterSet
Position:Named
필수:False
파이프라인의 값:False
속성 이름별 파이프라인의 값:False
나머지 인수의 값:False

-Repository

Specifies an array of hashtables that contain repository information. Use this parameter to register multiple repositories at once. Each hashtable can only have keys associated with parameters for the NameParameterSet.

매개 변수 속성

형식:

Hashtable[]

Default value:None
와일드카드 지원:False
DontShow:False

매개 변수 집합

RepositoriesParameterSet
Position:Named
필수:True
파이프라인의 값:False
속성 이름별 파이프라인의 값:False
나머지 인수의 값:False

-Trusted

Specifies whether the repository should be trusted.

매개 변수 속성

형식:SwitchParameter
Default value:False
와일드카드 지원:False
DontShow:False

매개 변수 집합

NameParameterSet
Position:Named
필수:False
파이프라인의 값:False
속성 이름별 파이프라인의 값:False
나머지 인수의 값:False

-Uri

Specifies the ___location of the repository to be registered. The value must use one of the following URI schemas:

  • https://
  • http://
  • ftp://
  • file://

매개 변수 속성

형식:String
Default value:None
와일드카드 지원:False
DontShow:False

매개 변수 집합

NameParameterSet
Position:Named
필수:False
파이프라인의 값:False
속성 이름별 파이프라인의 값:False
나머지 인수의 값:False

-WhatIf

Shows what would happen if the cmdlet runs. The cmdlet isn't run.

매개 변수 속성

형식:SwitchParameter
Default value:False
와일드카드 지원:False
DontShow:False
별칭:wi

매개 변수 집합

(All)
Position:Named
필수: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

출력

Microsoft.PowerShell.PSResourceGet.UtilClasses.PSRepositoryInfo

By default, the cmdlet produces no output. When you use the PassThru parameter, the cmdlet returns a PSRepositoryInfo object.