Unregister-PackageSource

Removes a registered package source.
Unregister-PackageSource [-Credential [<PSCredential>]] [-Force] [-ForceBootstrap] -InputObject* <PackageSource[]>[-Confirm] [-WhatIf] [<CommonParameters>]
Unregister-PackageSource [[-Source] [<String>]] [-Credential [<PSCredential>]] [-Force] [-ForceBootstrap][-Location [<String>]] [-ProviderName {Programs | msi | msu | PowerShellGet | nuget | chocolatey}] [-Confirm][-WhatIf] [<CommonParameters>]
Unregister-PackageSource [-PackageManagementProvider [<String>]] [-PublishLocation [<String>]][-ScriptPublishLocation [<String>]] [-ScriptSourceLocation [<String>]] [-Type {Module | Script | All}] [-Confirm][-WhatIf] [<CommonParameters>]
Unregister-PackageSource [-PackageManagementProvider [<String>]] [-PublishLocation [<String>]][-ScriptPublishLocation [<String>]] [-ScriptSourceLocation [<String>]] [-Type {Module | Script | All}] [-Confirm][-WhatIf] [<CommonParameters>]

The Unregister-PackageSource cmdlet removes a registered package source. Package sources are always managed by a package provider.

Parameters
-Credential [<PSCredential>]

Specifies a user account that has rights to unregister a package source for a specified package provider. Specify a user name, such as User01, or DomainUser01, 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.

-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 by using the package source’s object, which is shown in the results of the Get-PackageSource cmdlet.

-Location [<String>]

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

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

-Source [<String>]

Specifies the friendly name of the package source.

-Type [<String>]

Specifies the type of package source.

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

Outputs

This cmdlet does not generate any output.

Examples
  1. Unregister a package source for the Nuget provider:
    PS C:> Unregister-PackageSource -Source "MyRep" -Location "http://contoso/nuget/MyRepository/api/v3" -Provider "Nuget"
    

    This command unregisters a package source named Features for the Nuget provider. You are prompted to confirm that you want to unregister the package because the Force parameter is not specified,

  2. Unregister a package source by using a PackageSource object:
    PS C:> $A = Get-PackageSource -Name "MyRep" -Location "http://contoso/nuget/Features/api/v3"
    PS C:> Unregister-PackageSource -InputObject $A -Force
    

    This command unregisters a package source named Features for the Nuget provider by saving the results of a Get-PackageSource command to a variable, and then using the variable as input to Unregister-PackageSource. The Force parameter ensures that you are not prompted to confirm that you want to unregister the package.

Related Links

Get-PackageSource
Register-PackageSource
Set-PackageSource
Get-Credential