Register-PackageSource
Adds a package source for a specified package provider.
Syntax
SourceBySearch
Register-PackageSource
[[-Name] <String>]
[[-Location] <String>]
[-Proxy <Uri>]
[-ProxyCredential <PSCredential>]
[-Credential <PSCredential>]
[-Trusted]
[-Force]
[-ForceBootstrap]
[-WhatIf]
[-Confirm]
[-ProviderName <String>]
[<CommonParameters>]
NuGet
Register-PackageSource
[[-Name] <String>]
[[-Location] <String>]
[-Proxy <Uri>]
[-ProxyCredential <PSCredential>]
[-Credential <PSCredential>]
[-Trusted]
[-Force]
[-ForceBootstrap]
[-WhatIf]
[-Confirm]
[-ConfigFile <String>]
[-SkipValidate]
[<CommonParameters>]
PowerShellGet
Register-PackageSource
[[-Name] <String>]
[[-Location] <String>]
[-Proxy <Uri>]
[-ProxyCredential <PSCredential>]
[-Credential <PSCredential>]
[-Trusted]
[-Force]
[-ForceBootstrap]
[-WhatIf]
[-Confirm]
[-PackageManagementProvider <String>]
[-PublishLocation <String>]
[-ScriptSourceLocation <String>]
[-ScriptPublishLocation <String>]
[<CommonParameters>]
Description
The Register-PackageSource cmdlet adds a package source for a specified package provider. Package
sources are always managed by a package provider. If the package provider cannot add or replace a
package source, the provider generates an error message.
Examples
Example 1: Register a package source for the NuGet provider
This command registers a package source, a web-based location for the NuGet provider. By
default, sources aren't trusted. You are prompted to confirm the source is trusted before packages
are installed. To override the default, use the -Trusted parameter.
Register-PackageSource -Name MyNuGet -Location https://www.nuget.org/api/v2 -ProviderName NuGet
Name ProviderName IsTrusted Location
---- ------------ --------- --------
MyNuGet NuGet False https://www.nuget.org/api/v2
Parameters
-ConfigFile
Specifies a configuration file.
Parameter properties
Type: String
Default value: None
Supports wildcards: False
DontShow: False
Parameter sets
NuGet
Position: Named
Mandatory: False
Value from pipeline: False
Value from pipeline by property name: False
Value from remaining arguments: False
-Confirm
Prompts you for confirmation before running the cmdlet.
Parameter properties
Type: SwitchParameter
Default value: False
Supports wildcards: False
DontShow: False
Aliases: cf
Parameter sets
(All)
Position: Named
Mandatory: False
Value from pipeline: False
Value from pipeline by property name: False
Value from remaining arguments: False
-Credential
Specifies a user account that has permission to access the authenticated location.
Parameter properties
Type: PSCredential
Default value: None
Supports wildcards: False
DontShow: False
Parameter sets
(All)
Position: Named
Mandatory: False
Value from pipeline: False
Value from pipeline by property name: False
Value from remaining arguments: False
-Force
Forces the command to run without asking for user confirmation.
Parameter properties
Type: SwitchParameter
Default value: None
Supports wildcards: False
DontShow: False
Parameter sets
(All)
Position: Named
Mandatory: False
Value from pipeline: False
Value from pipeline by property name: False
Value from remaining arguments: False
-ForceBootstrap
Indicates that this cmdlet automatically installs the package provider.
Parameter properties
Type: SwitchParameter
Default value: None
Supports wildcards: False
DontShow: False
Parameter sets
(All)
Position: Named
Mandatory: False
Value from pipeline: False
Value from pipeline by property name: False
Value from remaining arguments: False
-Location
Specifies the package source location.
Parameter properties
Type: String
Default value: None
Supports wildcards: False
DontShow: False
Parameter sets
(All)
Position: 1
Mandatory: False
Value from pipeline: False
Value from pipeline by property name: False
Value from remaining arguments: False
-Name
Specifies the name of the package source to register.
Parameter properties
Type: String
Default value: None
Supports wildcards: False
DontShow: False
Parameter sets
(All)
Position: 0
Mandatory: False
Value from pipeline: False
Value from pipeline by property name: False
Value from remaining arguments: False
-PackageManagementProvider
Specifies the Package Management provider.
Parameter properties
Type: String
Default value: None
Supports wildcards: False
DontShow: False
Parameter sets
PowerShellGet
Position: Named
Mandatory: False
Value from pipeline: False
Value from pipeline by property name: False
Value from remaining arguments: False
-ProviderName
Specifies the package provider's name.
Parameter properties
Type: String
Default value: None
Accepted values: Bootstrap, NuGet, PowerShellGet
Supports wildcards: False
DontShow: False
Aliases: Provider
Parameter sets
SourceBySearch
Position: Named
Mandatory: False
Value from pipeline: False
Value from pipeline by property name: True
Value from remaining arguments: False
-Proxy
Specifies a proxy server for the request, rather than a direct connection to the internet resource.
Parameter properties
Type: Uri
Default value: None
Supports wildcards: False
DontShow: False
Parameter sets
(All)
Position: Named
Mandatory: False
Value from pipeline: False
Value from pipeline by property name: False
Value from remaining arguments: False
-ProxyCredential
Specifies a user account that has permission to use the proxy server that is specified by the
Proxy parameter.
Parameter properties
Type: PSCredential
Default value: None
Supports wildcards: False
DontShow: False
Parameter sets
(All)
Position: Named
Mandatory: False
Value from pipeline: False
Value from pipeline by property name: False
Value from remaining arguments: False
-PublishLocation
Specifies the publish location.
Parameter properties
Type: String
Default value: None
Supports wildcards: False
DontShow: False
Parameter sets
PowerShellGet
Position: Named
Mandatory: False
Value from pipeline: False
Value from pipeline by property name: False
Value from remaining arguments: False
-ScriptPublishLocation
Specifies the script publish location.
Parameter properties
Type: String
Default value: None
Supports wildcards: False
DontShow: False
Parameter sets
PowerShellGet
Position: Named
Mandatory: False
Value from pipeline: False
Value from pipeline by property name: False
Value from remaining arguments: False
-ScriptSourceLocation
Specifies the script source location.
Parameter properties
Type: String
Default value: None
Supports wildcards: False
DontShow: False
Parameter sets
PowerShellGet
Position: Named
Mandatory: False
Value from pipeline: False
Value from pipeline by property name: False
Value from remaining arguments: False
-SkipValidate
Switch that skips validating the credentials of a package source.
Parameter properties
Type: SwitchParameter
Default value: None
Supports wildcards: False
DontShow: False
Parameter sets
NuGet
Position: Named
Mandatory: False
Value from pipeline: False
Value from pipeline by property name: False
Value from remaining arguments: False
-Trusted
Indicates that the package source is trusted.
Parameter properties
Type: SwitchParameter
Default value: None
Supports wildcards: False
DontShow: False
Parameter sets
(All)
Position: Named
Mandatory: False
Value from pipeline: False
Value from pipeline by property name: False
Value from remaining arguments: False
-WhatIf
Shows what would happen if the cmdlet runs. The cmdlet is not run.
Parameter properties
Type: SwitchParameter
Default value: False
Supports wildcards: False
DontShow: False
Aliases: wi
Parameter sets
(All)
Position: Named
Mandatory: False
Value from pipeline: False
Value from pipeline by property name: False
Value from remaining arguments: 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 .
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 in the
PowerShell blog.