Register-PSResourceRepository
PowerShell 리소스에 대한 리포지토리를 등록합니다.
Syntax
Register-PSResourceRepository
[-Name] <String>
[-Uri] <String>
[-Trusted]
[-Priority <Int32>]
[-ApiVersion <APIVersion>]
[-CredentialInfo <PSCredentialInfo>]
[-PassThru]
[-Force]
[-WhatIf]
[-Confirm]
[<CommonParameters>]
Register-PSResourceRepository
[-PSGallery]
[-Trusted]
[-Priority <Int32>]
[-PassThru]
[-Force]
[-WhatIf]
[-Confirm]
[<CommonParameters>]
Register-PSResourceRepository
-Repository <Hashtable[]>
[-PassThru]
[-Force]
[-WhatIf]
[-Confirm]
[<CommonParameters>]
Description
cmdlet은 PowerShell 리소스를 포함하는 NuGet 리포지토리를 등록합니다.
예제
예 1
다음은 리포지토리를 이름에 등록하는 예제입니다PoshTestGallery
.
Register-PSResourceRepository -Name PoshTestGallery -Uri 'https://www.poshtestgallery.com/api/v2'
Get-PSResourceRepository -Name PoshTestGallery
Name Uri Trusted Priority
---- --- ------- --------
PoshTestGallery https://www.poshtestgallery.com/api/v2 False 50
예제 2
다음은 기본 PSGallery
리포지토리를 등록하는 예제입니다. 이전 예제와 달리 Name 및 Uri 매개 변수를 사용하여 리포지토리를 PSGallery
등록할 수 없습니다. PSGallery
리포지토리는 기본적으로 등록되지만 제거할 수 있습니다. 이 명령을 사용하여 기본 등록을 복원합니다.
Register-PSResourceRepository -PSGallery
Get-PSResourceRepository -Name 'PSGallery'
Name Uri Trusted Priority
---- --- ------- --------
PSGallery https://www.powershellgallery.com/api/v2 False 50
예 3
다음은 여러 리포지토리를 한 번에 등록하는 예제입니다. 이렇게 하려면 리포지토리 매개 변수를 사용하고 해시 테이블 배열을 제공합니다. 각 해시 테이블은 NameParameterSet 또는 PSGalleryParameterSet에 대한 매개 변수와 연결된 키만 가질 수 있습니다.
$arrayOfHashtables = @{
Name = 'Local'
Uri = 'D:/PSRepoLocal/'
Trusted = $true
Priority = 20
},
@{
Name = 'PSGv3'
Uri = 'https://www.powershellgallery.com/api/v3'
Trusted = $true
Priority = 50
},
@{
PSGallery = $true
Trusted = $true
Priority = 10
}
Register-PSResourceRepository -Repository $arrayOfHashtables
Get-PSResourceRepository
Name Uri Trusted Priority
---- --- ------- --------
PSGallery https://www.powershellgallery.com/api/v2 True 10
Local file:///D:/PSRepoLocal/ True 20
PSGv3 https://www.powershellgallery.com/api/v3 True 50
예시 4
다음은 등록된 SecretManagement 자격 증명 모음에서 검색할 자격 증명 정보를 사용하여 리포지토리를 등록하는 예제입니다. Microsoft.PowerShell.SecretManagement 모듈이 설치되어 있고 저장된 비밀을 포함하는 등록된 자격 증명 모음이 있어야 합니다. 비밀 형식은 리포지토리의 요구 사항과 일치해야 합니다.
$parameters = @{
Name = 'PSGv3'
Uri = 'https://www.powershellgallery.com/api/v3'
Trusted = $true
Priority = 50
CredentialInfo = [Microsoft.PowerShell.PSResourceGet.UtilClasses.PSCredentialInfo]::new(
'SecretStore', 'TestSecret')
}
Register-PSResourceRepository @parameters
Get-PSResourceRepository | Select-Object * -ExpandProperty CredentialInfo
Name : PSGv3
Uri : https://www.powershellgallery.com/api/v3
Trusted : True
Priority : 50
CredentialInfo : Microsoft.PowerShell.PSResourceGet.UtilClasses.PSCredentialInfo
VaultName : SecretStore
SecretName : TestSecret
Credential :
매개 변수
-ApiVersion
리포지토리에서 사용하는 API 버전을 지정합니다. 유효한 값은 다음과 같습니다.
v2
- NuGet V2 API 사용v3
- NuGet V3 API 사용local
- 파일 시스템 기반 리포지토리에 사용nugetServer
- NuGet.Server 기반 리포지토리에 사용
cmdlet은 Register-PSResourceRepository
API 버전을 자동으로 검색해야 합니다. 이 매개 변수를 사용하면 리포지토리를 등록한 후 API 버전을 변경할 수 있습니다.
Type: | Microsoft.PowerShell.PSResourceGet.UtilClasses.PSRepositoryInfo+APIVersion |
Accepted values: | unknown, v2, v3, local, nugetServer |
Position: | Named |
Default value: | None |
Required: | False |
Accept pipeline input: | False |
Accept wildcard characters: | False |
-Confirm
cmdlet을 실행하기 전에 확인 메시지가 표시됩니다.
Type: | SwitchParameter |
Aliases: | cf |
Position: | Named |
Default value: | False |
Required: | False |
Accept pipeline input: | False |
Accept wildcard characters: | False |
-CredentialInfo
자격 증명 모음의 이름과 Microsoft.PowerShell.SecretManagement 저장소에 저장된 비밀을 포함하는 PSCredentialInfo 개체입니다.
Type: | Microsoft.PowerShell.PSResourceGet.UtilClasses.PSCredentialInfo |
Position: | Named |
Default value: | None |
Required: | False |
Accept pipeline input: | False |
Accept wildcard characters: | False |
-Force
리포지토리가 이미 있는 경우 덮어씁니다.
Type: | SwitchParameter |
Position: | Named |
Default value: | False |
Required: | False |
Accept pipeline input: | False |
Accept wildcard characters: | False |
-Name
등록할 리포지토리의 이름입니다. 할 수 없습니다 PSGallery
.
Type: | String |
Position: | 0 |
Default value: | None |
Required: | True |
Accept pipeline input: | False |
Accept wildcard characters: | False |
-PassThru
지정하면 성공적으로 등록된 리포지토리 및 해당 정보를 표시합니다.
Type: | SwitchParameter |
Position: | Named |
Default value: | False |
Required: | False |
Accept pipeline input: | False |
Accept wildcard characters: | False |
-Priority
리포지토리의 우선 순위 순위를 지정합니다. 유효한 우선 순위 값의 범위는 0에서 100까지입니다. 값이 낮을수록 우선 순위가 높습니다. 기본값은 50
입니다.
리포지토리는 우선 순위별로 정렬된 다음 이름으로 정렬됩니다. 여러 리포지 토리에서 리소스를 검색할 때 PSResourceGet cmdlet은 이 정렬 순서를 사용하여 리포지토리를 검색하고 찾은 첫 번째 일치 항목을 반환합니다.
Type: | Int32 |
Position: | Named |
Default value: | 50 |
Required: | False |
Accept pipeline input: | False |
Accept wildcard characters: | False |
-PSGallery
지정하면 PSGallery 리포지토리를 등록합니다.
Type: | SwitchParameter |
Position: | Named |
Default value: | False |
Required: | True |
Accept pipeline input: | False |
Accept wildcard characters: | False |
-Repository
리포지토리 정보를 포함하는 해시 테이블의 배열을 지정합니다. 이 매개 변수를 사용하여 한 번에 여러 리포지토리를 등록합니다. 각 해시 테이블은 NameParameterSet 또는 PSGalleryParameterSet에 대한 매개 변수와 연결된 키만 가질 수 있습니다.
Type: | Hashtable[] |
Position: | Named |
Default value: | None |
Required: | True |
Accept pipeline input: | False |
Accept wildcard characters: | False |
-Trusted
리포지토리를 신뢰할 수 있는지 여부를 지정합니다.
Type: | SwitchParameter |
Position: | Named |
Default value: | False |
Required: | False |
Accept pipeline input: | False |
Accept wildcard characters: | False |
-Uri
등록할 리포지토리의 위치를 지정합니다. 값은 다음 URI 스키마 중 하나를 사용해야 합니다.
https://
http://
ftp://
file://
Type: | String |
Position: | 1 |
Default value: | None |
Required: | True |
Accept pipeline input: | False |
Accept wildcard characters: | False |
-WhatIf
cmdlet이 실행될 경우 결과 동작을 표시합니다. cmdlet이 실행되지 않습니다.
Type: | SwitchParameter |
Aliases: | wi |
Position: | Named |
Default value: | False |
Required: | False |
Accept pipeline input: | False |
Accept wildcard characters: | False |
입력
None
출력
Microsoft.PowerShell.PSResourceGet.UtilClasses.PSRepositoryInfo
기본적으로 cmdlet은 출력을 생성하지 않습니다. PassThru 매개 변수를 사용하는 경우 cmdlet은 PSRepositoryInfo 개체를 반환합니다.
참고
리포지토리는 이름별로 고유합니다. 동일한 이름으로 리포지토리를 등록하려고 시도하면 오류가 발생합니다.
관련 링크
PSResourceGet
피드백
https://aka.ms/ContentUserFeedback
출시 예정: 2024년 내내 콘텐츠에 대한 피드백 메커니즘으로 GitHub 문제를 단계적으로 폐지하고 이를 새로운 피드백 시스템으로 바꿀 예정입니다. 자세한 내용은 다음을 참조하세요.다음에 대한 사용자 의견 제출 및 보기