Cmdlets

Choose a cmdlet from the list on the left or search for a specific cmdlet. Choose a cmdlet from the list or search for a specific cmdlet.
About Help  Providers
 

Register-PackageSource

Register-PackageSource

microsoft.powershell.packagemanagement.dll, microsoft.powershell.oneget.dll

Synopsis

Adds a package source for a specified package provider.

Syntax

Register-PackageSource [-Name] [-Location] [-Credential] [-Force] [-ForceBootstrap] [-Trusted] [-ProviderName] [-Confirm] [-WhatIf] [<CommonParameters>]

Detailed Description

Register-PackageSource 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.

Parameters

-Credential <PSCredential>

Specifies a user account that has rights to register a package source for a specified package provider. Specify a user name, such as "User01", or "Domain\User01", or specify a PSCredential object, such as one generated by the Get-Credential cmdlet. The simplest way to specify a PSCredential object is to save the results of a Get-Credential cmdlet as a variable. When you add this parameter and specify a user name, you are prompted to provide a password after you run the command.

Aliases

None

Required?

false

Position

named

Default value

Accept pipeline input?

false

Accept wildcard characters?

false

-Force <SwitchParameter>

Suppresses the user confirmation prompt. Without this parameter, Register-PackageSource prompts you to confirm that you want to replace an existing source.

Aliases

None

Required?

false

Position

named

Default value

Accept pipeline input?

false

Accept wildcard characters?

false

-ForceBootstrap <SwitchParameter>

Forces OneGet to bootstrap—or automatically install—the package provider for the specified package source.

Aliases

None

Required?

false

Position

named

Default value

Accept pipeline input?

false

Accept wildcard characters?

false

-Location <String>

The location to which a package source points. The value of this parameter can be a URI, a file path, or any other destination format that is supported by the package provider.

Aliases

None

Required?

false

Position

2

Default value

Accept pipeline input?

false

Accept wildcard characters?

false

-Name <String>

Specifies a friendly name for the package source that you want to create.

Aliases

None

Required?

false

Position

1

Default value

Accept pipeline input?

false

Accept wildcard characters?

false

-ProviderName <String>

Specifies the provider name.

Aliases

None

Required?

true

Position

named

Default value

Accept pipeline input?

True (ByPropertyName)

Accept wildcard characters?

false

-Trusted <SwitchParameter>

Indicates whether users trust packages from this source; that is, indicates whether users are prompted to verify that they trust the package source before they install a package from it. If you add this parameter, users are not prompted.

Aliases

None

Required?

false

Position

named

Default value

Accept pipeline input?

false

Accept wildcard characters?

false

-Confirm <SwitchParameter>

Prompts you for confirmation before running the cmdlet.

Aliases

None

Required?

false

Position

named

Default value

false

Accept pipeline input?

false

Accept wildcard characters?

false

-WhatIf <SwitchParameter>

Shows what would happen if the cmdlet runs. The cmdlet is not run.

Aliases

None

Required?

false

Position

named

Default value

false

Accept pipeline input?

false

Accept wildcard characters?

false

Input Type


Return Type


Notes

None

Examples

Example 1: Register a package source for the NuGet provider

This example registers a package source, a web-based location for the PSModule provider. If you do not add the Trusted parameter, by default, the package is not trusted, and users are prompted to confirm that they trust the source before installing packages from the source.

PS C:\>Register-PackageSource -Name 'myRep' -Location 'http://contoso/psmodule/Features/api/v3' –ProviderName 'psModule'

Online Version
Get-PackageSource
Set-PackageSource
Unregister-PackageSource