| external help file | Microsoft.PowerShell.PSResourceGet.dll-Help.xml |
|---|---|
| Module Name | Microsoft.PowerShell.PSResourceGet |
| ms.custom | 1.2.0-p5 |
| ms.date | 03/18/2026 |
| online version | https://learn.microsoft.com/powershell/module/microsoft.powershell.psresourceget/set-psresourcerepository?view=powershellget-3.x&WT.mc_id=ps-gethelp |
| schema | 2.0.0 |
Sets information for a registered repository.
Set-PSResourceRepository [-Name] <String> [-Uri <String>] [-Trusted] [-Priority <Int32>]
[-ApiVersion <APIVersion>] [-CredentialInfo <PSCredentialInfo>] [-PassThru]
[-CredentialProvider <CredentialProvider>] [-WhatIf] [-Confirm] [<CommonParameters>]
Set-PSResourceRepository -Repository <Hashtable[]> [-PassThru] [-WhatIf] [-Confirm]
[<CommonParameters>]
The Set-PSResourceRepository cmdlet sets information for a registered repository.
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" -PassThruName Uri Trusted Priority
---- --- ------- --------
PoshTestGallery file:///c:/code/testdir False 50
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 -PassThruName Uri Trusted Priority
---- --- ------- --------
PSGallery https://www.powershellgallery.com/api/v2 True 25
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-PSResourceRepositoryName 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 -PassThruName Uri Trusted Priority
---- --- ------- --------
PSGallery https://www.powershellgallery.com/api/v2 True 50
PoshTestGallery file:///c:/code/testdir False 50
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 CredentialInfoName : PoshTestGallery
Uri : file:///c:/code/testdir
Trusted : False
Priority : 50
CredentialInfo : Microsoft.PowerShell.PowerShellGet.UtilClasses.PSCredentialInfo
VaultName : SecretStore
SecretName : TestSecret
Credential :
Specifies the API version used by the repository. Valid values are:
v2- uses the NuGet V2 APIv3- uses the NuGet V3 APIContainerRegistry- used for Azure Container Registrylocal- use this for file system based repositoriesnugetServer- 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.
Type: Microsoft.PowerShell.PSResourceGet.UtilClasses.PSRepositoryInfo+APIVersion
Parameter Sets: NameParameterSet
Aliases:
Accepted values: V2, V3, Local, NugetServer, ContainerRegistry
Required: False
Position: Named
Default value: None
Accept pipeline input: False
Accept wildcard characters: FalseA PSCredentialInfo object that includes the name of a vault and a secret that's stored in a Microsoft.PowerShell.SecretManagement store.
Type: Microsoft.PowerShell.PSResourceGet.UtilClasses.PSCredentialInfo
Parameter Sets: NameParameterSet
Aliases:
Required: False
Position: Named
Default value: None
Accept pipeline input: False
Accept wildcard characters: FalseThis is a dynamic parameter that specifies the credential provider to use for the repository. This parameter is only available when the named repository is an Azure Artifacts feed. Valid values are:
None- No credential provider definedAzArtifacts- Use the Azure Artifacts Credential Provider
Type: Microsoft.PowerShell.PSResourceGet.UtilClasses.CredentialProviderType
Parameter Sets: NameParameterSet
Accepted values: None, AzArtifacts
Aliases:
Required: False
Position: Named
Default value: None
Accept pipeline input: False
Accept wildcard characters: FalseSpecifies the name of the repository to be modified.
Note
The Uri value of the default PSGallery repository can't be changed.
Type: System.String
Parameter Sets: NameParameterSet
Aliases:
Required: True
Position: 0
Default value: None
Accept pipeline input: True (ByPropertyName, ByValue)
Accept wildcard characters: FalseWhen specified, displays the successfully registered repository and its information.
Type: System.Management.Automation.SwitchParameter
Parameter Sets: (All)
Aliases:
Required: False
Position: Named
Default value: False
Accept pipeline input: False
Accept wildcard characters: FalseSpecifies 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.
Type: System.Int32
Parameter Sets: NameParameterSet
Aliases:
Required: False
Position: Named
Default value: 50
Accept pipeline input: False
Accept wildcard characters: FalseSpecifies 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.
Type: System.Collections.Hashtable[]
Parameter Sets: RepositoriesParameterSet
Aliases:
Required: True
Position: Named
Default value: None
Accept pipeline input: False
Accept wildcard characters: FalseSpecifies whether the repository should be trusted.
Type: System.Management.Automation.SwitchParameter
Parameter Sets: NameParameterSet
Aliases:
Required: False
Position: Named
Default value: False
Accept pipeline input: False
Accept wildcard characters: FalseSpecifies the location of the repository to be registered. The value must use one of the following URI schemas:
https://http://ftp://file://
Type: System.String
Parameter Sets: NameParameterSet
Aliases:
Required: False
Position: Named
Default value: None
Accept pipeline input: False
Accept wildcard characters: FalsePrompts you for confirmation before running the cmdlet.
Type: System.Management.Automation.SwitchParameter
Parameter Sets: (All)
Aliases: cf
Required: False
Position: Named
Default value: False
Accept pipeline input: False
Accept wildcard characters: FalseShows what would happen if the cmdlet runs. The cmdlet isn't run.
Type: System.Management.Automation.SwitchParameter
Parameter Sets: (All)
Aliases: wi
Required: False
Position: Named
Default value: False
Accept pipeline input: False
Accept wildcard characters: FalseThis cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. For more information, see about_CommonParameters.
By default, the cmdlet produces no output. When you use the PassThru parameter, the cmdlet returns a PSRepositoryInfo object.