Set-PackageSource

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

The Set-PackageSource replaces a package source for a specified package provider. Package sources are always managed by a package provider.

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 forces Package Management to automatically install the package provider for the specified package source.

-InputObject <PackageSource>

  • This value is required
  • Accepts pipeline input ByValue

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.

-Location [<String>]

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

-Name [<String>]

Specifies the current friendly name of a package source.

-NewLocation [<String>]

Specifies the new location to which you want a package source to point. The value of this parameter can be a URI, a file path, or any other destination format supported by the package provider.

-NewName [<String>]

Specifies the new friendly name that you want to assign to a package source.

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

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

Inputs

You cannot pipe input to this cmdlet.

This cmdlet does not generate any output.

Examples
  1. Change a package source:
    PS C:> Set-PackageSource -Name "PsRep" -NewName "PS-Feature-Rep" -Trusted -ProviderName "PSModule"
    

    This command changes the friendly name of a package source for the PSModule provider. It also changes the package source to be trusted, so that users who install packages from this source are not prompted to verify that they trust the source.

Related Links

Get-PackageSource
Register-PackageSource
Unregister-PackageSource