Edit

Share via


Unregister-PackageSource

Removes a registered package source.

Syntax

SourceBySearch

Unregister-PackageSource
    [[-Source] <String>]
    [-Location <String>]
    [-Credential <PSCredential>]
    [-Force]
    [-ForceBootstrap]
    [-WhatIf]
    [-Confirm]
    [-ProviderName <String>]
    [<CommonParameters>]

SourceByInputObject

Unregister-PackageSource
    -InputObject <PackageSource[]>
    [-Credential <PSCredential>]
    [-Force]
    [-ForceBootstrap]
    [-WhatIf]
    [-Confirm]
    [<CommonParameters>]

NuGet:SourceByInputObject

Unregister-PackageSource
    [-Credential <PSCredential>]
    [-Force]
    [-ForceBootstrap]
    [-WhatIf]
    [-Confirm]
    [-ConfigFile <String>]
    [-SkipValidate]
    [<CommonParameters>]

NuGet:SourceBySearch

Unregister-PackageSource
    [-Credential <PSCredential>]
    [-Force]
    [-ForceBootstrap]
    [-WhatIf]
    [-Confirm]
    [-ConfigFile <String>]
    [-SkipValidate]
    [<CommonParameters>]

PowerShellGet:SourceByInputObject

Unregister-PackageSource
    [-Credential <PSCredential>]
    [-Force]
    [-ForceBootstrap]
    [-WhatIf]
    [-Confirm]
    [-PackageManagementProvider <String>]
    [-PublishLocation <String>]
    [-ScriptSourceLocation <String>]
    [-ScriptPublishLocation <String>]
    [<CommonParameters>]

PowerShellGet:SourceBySearch

Unregister-PackageSource
    [-Credential <PSCredential>]
    [-Force]
    [-ForceBootstrap]
    [-WhatIf]
    [-Confirm]
    [-PackageManagementProvider <String>]
    [-PublishLocation <String>]
    [-ScriptSourceLocation <String>]
    [-ScriptPublishLocation <String>]
    [<CommonParameters>]

Description

The Unregister-PackageSource cmdlet removes a registered package source. Package sources are always managed by a package provider. To find package sources, use the Get-PackageSource cmdlet.

Examples

Example 1: Unregister a package source for the NuGet provider

The Unregister-PackageSource cmdlet unregisters a package source from the local computer. The Location and Provider parameters can be used to further specify the source to remove.

PS> Unregister-PackageSource -Source MyNuGet

The Unregister-PackageSource cmdlet uses the Source parameter to specify which source to remove.

Example 2: Use a PackageSource object to unregister a package

This example uses the Get-PackageSource and Unregister-PackageSource to unregister a package source. The PackageSource object is stored in a variable.

PS> $pkgsource = Get-PackageSource -Name MyNuGet
PS> Unregister-PackageSource -InputObject $pkgsource

The $pkgsource variable stores the PackageSource created by the Get-PackageSource cmdlet. Unregister-PackageSource uses the $pkgsource as input to the InputObject parameter.

As an alternative, the Unregister-PackageSource cmdlet can specify a value for the InputObject parameter:

Unregister-PackageSource -InputObject ( Get-PackageSource -Name MyNuGet )

Parameters

-ConfigFile

Specifies a configuration file.

Parameter properties

Type:String
Default value:None
Supports wildcards:False
DontShow:False

Parameter sets

NuGet:SourceByInputObject
Position:Named
Mandatory:False
Value from pipeline:False
Value from pipeline by property name:False
Value from remaining arguments:False
NuGet:SourceBySearch
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 Unregister-PackageSource is run.

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 computer and run commands. Type a user name, such as User01, Domain01\User01, or enter a PSCredential object, generated by the Get-Credential cmdlet. If you type a user name, you're prompted for a password.

When the Credential parameter isn't specified, the current user account is used.

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. Overrides restrictions that prevent Unregister-PackageSource from succeeding, with the exception of security.

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 Unregister-PackageSource forces PackageManagement to automatically uninstall the package provider for the specified package source.

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

-InputObject

Accepts pipeline input that specifies the PackageSource object from the Get-PackageSource cmdlet. InputObject accepts the PackageSource object as a Get-PackageSource value or a variable that contains the object.

Parameter properties

Type:

Microsoft.PackageManagement.Packaging.PackageSource[]

Default value:None
Supports wildcards:False
DontShow:False

Parameter sets

SourceByInputObject
Position:Named
Mandatory:True
Value from pipeline:True
Value from pipeline by property name:False
Value from remaining arguments:False

-Location

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.

Parameter properties

Type:String
Default value:None
Supports wildcards:False
DontShow:False

Parameter sets

SourceBySearch
Position:Named
Mandatory:False
Value from pipeline:False
Value from pipeline by property name:False
Value from remaining arguments:False

-PackageManagementProvider

Specifies the PackageManagement provider.

Parameter properties

Type:String
Default value:None
Supports wildcards:False
DontShow:False

Parameter sets

PowerShellGet:SourceByInputObject
Position:Named
Mandatory:False
Value from pipeline:False
Value from pipeline by property name:False
Value from remaining arguments:False
PowerShellGet:SourceBySearch
Position:Named
Mandatory:False
Value from pipeline:False
Value from pipeline by property name:False
Value from remaining arguments:False

-ProviderName

Specifies the provider 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

-PublishLocation

Specifies the publish location.

Parameter properties

Type:String
Default value:None
Supports wildcards:False
DontShow:False

Parameter sets

PowerShellGet:SourceByInputObject
Position:Named
Mandatory:False
Value from pipeline:False
Value from pipeline by property name:False
Value from remaining arguments:False
PowerShellGet:SourceBySearch
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:SourceByInputObject
Position:Named
Mandatory:False
Value from pipeline:False
Value from pipeline by property name:False
Value from remaining arguments:False
PowerShellGet:SourceBySearch
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:SourceByInputObject
Position:Named
Mandatory:False
Value from pipeline:False
Value from pipeline by property name:False
Value from remaining arguments:False
PowerShellGet:SourceBySearch
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:SourceByInputObject
Position:Named
Mandatory:False
Value from pipeline:False
Value from pipeline by property name:False
Value from remaining arguments:False
NuGet:SourceBySearch
Position:Named
Mandatory:False
Value from pipeline:False
Value from pipeline by property name:False
Value from remaining arguments:False

-Source

Specifies the friendly name of the package source.

Parameter properties

Type:String
Default value:None
Supports wildcards:False
DontShow:False
Aliases:Name

Parameter sets

SourceBySearch
Position:0
Mandatory:False
Value from pipeline:False
Value from pipeline by property name:False
Value from remaining arguments:False

-WhatIf

Shows what would happen if Unregister-PackageSource cmdlet is run. The cmdlet isn't 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.

Inputs

Microsoft.PackageManagement.Packaging.PackageSource

You can pipe a PackageSource object to this cmdlet

Outputs

None

This cmdlet returns no output.

Notes

Including a package provider in a command can make dynamic parameters available to a cmdlet. Dynamic parameters are specific to a package provider. The Get-Help cmdlet lists a cmdlet's parameter sets and includes the provider's parameter set.