Set-PackageSource
SYNOPSIS
Replaces a package source for a specified package provider.
SYNTAX
SourceBySearch (Default)
Set-PackageSource [-Proxy <Uri>] [-ProxyCredential <PSCredential>] [-Credential <PSCredential>]
[[-Name] <String>] [-Location <String>] [-NewLocation <String>] [-NewName <String>] [-Trusted] [-Force]
[-ForceBootstrap] [-WhatIf] [-Confirm] [-ProviderName <String>] [<CommonParameters>]
SourceByInputObject
Set-PackageSource [-Proxy <Uri>] [-ProxyCredential <PSCredential>] [-Credential <PSCredential>]
[-NewLocation <String>] [-NewName <String>] [-Trusted] -InputObject <PackageSource> [-Force] [-ForceBootstrap]
[-WhatIf] [-Confirm] [<CommonParameters>]
NuGet:SourceByInputObject
Set-PackageSource [-Proxy <Uri>] [-ProxyCredential <PSCredential>] [-Credential <PSCredential>]
[-NewLocation <String>] [-NewName <String>] [-Trusted] [-Force] [-ForceBootstrap] [-WhatIf] [-Confirm]
[-ConfigFile <String>] [-SkipValidate] [<CommonParameters>]
NuGet:SourceBySearch
Set-PackageSource [-Proxy <Uri>] [-ProxyCredential <PSCredential>] [-Credential <PSCredential>]
[-NewLocation <String>] [-NewName <String>] [-Trusted] [-Force] [-ForceBootstrap] [-WhatIf] [-Confirm]
[-ConfigFile <String>] [-SkipValidate] [<CommonParameters>]
PowerShellGet:SourceByInputObject
Set-PackageSource [-Proxy <Uri>] [-ProxyCredential <PSCredential>] [-Credential <PSCredential>]
[-NewLocation <String>] [-NewName <String>] [-Trusted] [-Force] [-ForceBootstrap] [-WhatIf] [-Confirm]
[-PackageManagementProvider <String>] [-PublishLocation <String>] [-ScriptSourceLocation <String>]
[-ScriptPublishLocation <String>] [<CommonParameters>]
PowerShellGet:SourceBySearch
Set-PackageSource [-Proxy <Uri>] [-ProxyCredential <PSCredential>] [-Credential <PSCredential>]
[-NewLocation <String>] [-NewName <String>] [-Trusted] [-Force] [-ForceBootstrap] [-WhatIf] [-Confirm]
[-PackageManagementProvider <String>] [-PublishLocation <String>] [-ScriptSourceLocation <String>]
[-ScriptPublishLocation <String>] [<CommonParameters>]
DESCRIPTION
The `Set-PackageSource` replaces a package source for a specified package provider. Package sources are always managed by a package provider.
EXAMPLES
Example 1: Change a package source
PS C:\> Set-PackageSource -Name MyNuget -NewName NewNuGet -Trusted -ProviderName NuGet
PARAMETERS
-ConfigFile
Specifies a configuration file.
Type: System.String
Parameter Sets: NuGet:SourceByInputObject, NuGet:SourceBySearch
Aliases:
Required: False
Position: Named
Default value: None
Accept pipeline input: False
Accept wildcard characters: False
-Credential
Specifies a user account that has permission to install package providers.
Type: System.Management.Automation.PSCredential
Parameter Sets: (All)
Aliases:
Required: False
Position: Named
Default value: None
Accept pipeline input: False
Accept wildcard characters: False
-Force
Forces the command to run without asking for user confirmation.
Type: System.Management.Automation.SwitchParameter
Parameter Sets: (All)
Aliases:
Required: False
Position: Named
Default value: False
Accept pipeline input: False
Accept wildcard characters: False
-ForceBootstrap
Indicates that `Set-PackageSource` forces PackageManagement to automatically install the package provider.
Type: System.Management.Automation.SwitchParameter
Parameter Sets: (All)
Aliases:
Required: False
Position: Named
Default value: False
Accept pipeline input: False
Accept wildcard characters: False
-InputObject
Specifies a package source ID object that represents the package that you want to change. Package source IDs are part of the results of the `Get-PackageSource` cmdlet.
Type: Microsoft.PackageManagement.Packaging.PackageSource
Parameter Sets: SourceByInputObject
Aliases:
Required: True
Position: Named
Default value: None
Accept pipeline input: True (ByValue)
Accept wildcard characters: False
-Location
Specifies the current package source location. The value can be a URI, a file path, or any other destination format supported by the package provider.
Type: System.String
Parameter Sets: SourceBySearch
Aliases:
Required: False
Position: Named
Default value: None
Accept pipeline input: False
Accept wildcard characters: False
-Name
Specifies a package source's name.
Type: System.String
Parameter Sets: SourceBySearch
Aliases: SourceName
Required: False
Position: 0
Default value: None
Accept pipeline input: False
Accept wildcard characters: False
-NewLocation
Specifies the new location for a package source. The value can be a URI, a file path, or any other destination format supported by the package provider.
Type: System.String
Parameter Sets: (All)
Aliases:
Required: False
Position: Named
Default value: None
Accept pipeline input: False
Accept wildcard characters: False
-NewName
Specifies the new name you assign to a package source.
Type: System.String
Parameter Sets: (All)
Aliases:
Required: False
Position: Named
Default value: None
Accept pipeline input: False
Accept wildcard characters: False
-PackageManagementProvider
Specifies a package management provider.
Type: System.String
Parameter Sets: PowerShellGet:SourceByInputObject, PowerShellGet:SourceBySearch
Aliases:
Required: False
Position: Named
Default value: None
Accept pipeline input: False
Accept wildcard characters: False
-ProviderName
Specifies a provider name.
Type: System.String
Parameter Sets: SourceBySearch
Aliases: Provider
Accepted values: Bootstrap, NuGet, PowerShellGet
Required: False
Position: Named
Default value: None
Accept pipeline input: True (ByPropertyName)
Accept wildcard characters: False
-Proxy
Specifies a proxy server for the request, rather than connecting directly to the Internet resource.
Type: System.Uri
Parameter Sets: (All)
Aliases:
Required: False
Position: Named
Default value: None
Accept pipeline input: False
Accept wildcard characters: False
-ProxyCredential
Specifies a user account that has permission to use the proxy server that is specified by the Proxy parameter.
Type: System.Management.Automation.PSCredential
Parameter Sets: (All)
Aliases:
Required: False
Position: Named
Default value: None
Accept pipeline input: False
Accept wildcard characters: False
-PublishLocation
Specifies the publish location.
Type: System.String
Parameter Sets: PowerShellGet:SourceByInputObject, PowerShellGet:SourceBySearch
Aliases:
Required: False
Position: Named
Default value: None
Accept pipeline input: False
Accept wildcard characters: False
-ScriptPublishLocation
Specifies the script publish location.
Type: System.String
Parameter Sets: PowerShellGet:SourceByInputObject, PowerShellGet:SourceBySearch
Aliases:
Required: False
Position: Named
Default value: None
Accept pipeline input: False
Accept wildcard characters: False
-ScriptSourceLocation
Specifies the script source location.
Type: System.String
Parameter Sets: PowerShellGet:SourceByInputObject, PowerShellGet:SourceBySearch
Aliases:
Required: False
Position: Named
Default value: None
Accept pipeline input: False
Accept wildcard characters: False
-SkipValidate
Switch that skips validating the credentials of a package source.
Type: System.Management.Automation.SwitchParameter
Parameter Sets: NuGet:SourceByInputObject, NuGet:SourceBySearch
Aliases:
Required: False
Position: Named
Default value: False
Accept pipeline input: False
Accept wildcard characters: False
-Trusted
Indicates that the source is a trusted package provider. Trusted sources don't prompt for verification to install packages.
Type: System.Management.Automation.SwitchParameter
Parameter Sets: (All)
Aliases:
Required: False
Position: Named
Default value: False
Accept pipeline input: False
Accept wildcard characters: False
-Confirm
Prompts 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: False
-WhatIf
Shows what would happen if the cmdlet runs. The cmdlet is not 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: False
CommonParameters
This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. For more information, see about_CommonParameters.
INPUTS
Set-PackageSource
doesn't accept pipeline input.
OUTPUTS
This cmdlet does not generate any output.
NOTES
> [!IMPORTANT] > As of April 2020, the PowerShell Gallery no longer supports Transport Layer Security (TLS) > versions 1.0 and 1.1. If you are not using TLS 1.2 or higher, you will receive an error when > trying to access the PowerShell Gallery. Use the following command to ensure you are using TLS > 1.2: > > `[Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12` > > For more information, see the > announcement (https://devblogs.microsoft.com/powershell/powershell-gallery-tls-support/)in the > PowerShell blog.