Register-PackageSource

Adds a package source for a specified package provider.
Register-PackageSource [[-Name] [<String>]] [[-Location] [<String>]] [-Credential [<PSCredential>]] [-Force][-ForceBootstrap] [-ProviderName {Programs | msi | msu | PowerShellGet | nuget | chocolatey}] [-Trusted][-Confirm] [-WhatIf] [<CommonParameters>]
Register-PackageSource [[-Name] [<String>]] [[-Location] [<String>]] [-Credential [<PSCredential>]] [-Force][-ForceBootstrap] [-PackageManagementProvider [<String>]] [-PublishLocation [<String>]] [-ScriptPublishLocation[<String>]] [-ScriptSourceLocation [<String>]] [-Trusted] [-Type {Module | Script | All}] [-Confirm] [-WhatIf][<CommonParameters>]

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.

Parameters
-Credential [<PSCredential>]

Specifies a user account that has permission to install package providers.

-Force [<SwitchParameter>]

Forces the command to run without asking for user confirmation.

-ForceBootstrap [<SwitchParameter>]

Indicates that this cmdlet automatically installs the package provider.

-Location [<String>]

Specifies the package source location.

-Name [<String>]

Specifies the name of the package source to register.

-PackageManagementProvider [<String>]

Specifies the Package Management provider.

-ProviderName [<String>]

Specifies the provider name.

-PublishLocation [<String>]

Specifies the publish location.

-ScriptPublishLocation [<String>]

Specifies the script publish location.

-ScriptSourceLocation [<String>]

Specifies the script source location.

-Trusted [<SwitchParameter>]

Indicates that the package source is trusted.

-Type [<String>]

Specifies the type of package source. The acceptable values for this parameter are:

— Module– Script– All

-Confirm [<SwitchParameter>]

  • Default value is false

Prompts you for confirmation before running the cmdlet.Prompts you for confirmation before running the cmdlet.

-WhatIf [<SwitchParameter>]

  • Default value is false

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

<CommonParameters>

This cmdlet supports the common parameters: Verbose, Debug,ErrorAction, ErrorVariable, WarningAction, WarningVariable,OutBuffer, PipelineVariable, and OutVariable.

Examples
  1. Register a package source for the NuGet provider:
    PS C:> Register-PackageSource -Name "MyRep" -Location "http://contoso/psmodule/Features/api/v3" -ProviderName "PsModule"
    

    This command 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.

Related Links

Get-PackageSource
Set-PackageSource
Unregister-PackageSource