Skip to content

Uninstall-Package

SYNOPSIS

Uninstalls one or more software packages.

SYNTAX

PackageByInputObject

Uninstall-Package [-InputObject] <SoftwareIdentity[]> [-AllVersions] [-Force] [-ForceBootstrap] [-WhatIf]
 [-Confirm] [<CommonParameters>]

PackageBySearch

Uninstall-Package [-Name] <String[]> [-RequiredVersion <String>] [-MinimumVersion <String>]
 [-MaximumVersion <String>] [-AllVersions] [-Force] [-ForceBootstrap] [-WhatIf] [-Confirm]
 [-ProviderName <String[]>] [<CommonParameters>]

NuGet:PackageByInputObject

Uninstall-Package [-AllVersions] [-Force] [-ForceBootstrap] [-WhatIf] [-Confirm] [-Destination <String>]
 [-ExcludeVersion] [-Scope <String>] [-SkipDependencies] [<CommonParameters>]

NuGet:PackageBySearch

Uninstall-Package [-AllVersions] [-Force] [-ForceBootstrap] [-WhatIf] [-Confirm] [-Destination <String>]
 [-ExcludeVersion] [-Scope <String>] [-SkipDependencies] [<CommonParameters>]

PowerShellGet:PackageByInputObject

Uninstall-Package [-AllVersions] [-Force] [-ForceBootstrap] [-WhatIf] [-Confirm] [-Scope <String>]
 [-PackageManagementProvider <String>] [-Type <String>] [-AllowClobber] [-SkipPublisherCheck] [-InstallUpdate]
 [-NoPathUpdate] [-AllowPrereleaseVersions] [<CommonParameters>]

PowerShellGet:PackageBySearch

Uninstall-Package [-AllVersions] [-Force] [-ForceBootstrap] [-WhatIf] [-Confirm] [-Scope <String>]
 [-PackageManagementProvider <String>] [-Type <String>] [-AllowClobber] [-SkipPublisherCheck] [-InstallUpdate]
 [-NoPathUpdate] [-AllowPrereleaseVersions] [<CommonParameters>]

DESCRIPTION

The `Uninstall-Package` cmdlet uninstalls one or more software packages from the local computer. To find installed packages, use the `Get-Package` cmdlet.

EXAMPLES

Example 1: Uninstall a package

PS> Uninstall-Package -Name NuGet.Core

Example 2: Use the pipeline to uninstall a package

PS> Get-Package -Name NuGet.Core -RequiredVersion 2.14.0 | Uninstall-Package

The `Get-Package` cmdlet uses the Name and RequiredVersion parameters to specify a package. A SoftwareIdentity object is sent down the pipeline. The `Uninstall-Package` cmdlet receives the object as an InputObject and removes the package.

As an alternative, the `Uninstall-Package` cmdlet can specify a value for the InputObject parameter:

`Uninstall-Package -InputObject ( Get-Package -Name NuGet.Core -RequiredVersion 2.14.0 )`

PARAMETERS

-AllowClobber

Overrides warning messages about conflicts with existing commands. Overwrites existing commands that have the same name as commands being installed.

Type: System.Management.Automation.SwitchParameter
Parameter Sets: PowerShellGet:PackageByInputObject, PowerShellGet:PackageBySearch
Aliases:

Required: False
Position: Named
Default value: False
Accept pipeline input: False
Accept wildcard characters: False

-AllowPrereleaseVersions

Allows packages marked as prerelease to be uninstalled.

Type: System.Management.Automation.SwitchParameter
Parameter Sets: PowerShellGet:PackageByInputObject, PowerShellGet:PackageBySearch
Aliases:

Required: False
Position: Named
Default value: False
Accept pipeline input: False
Accept wildcard characters: False

-AllVersions

Indicates that this cmdlet uninstalls all versions of the package.

Type: System.Management.Automation.SwitchParameter
Parameter Sets: (All)
Aliases:

Required: False
Position: Named
Default value: False
Accept pipeline input: False
Accept wildcard characters: False

-Destination

Specifies a string of the path to the input object.

Type: System.String
Parameter Sets: NuGet:PackageByInputObject, NuGet:PackageBySearch
Aliases:

Required: False
Position: Named
Default value: None
Accept pipeline input: False
Accept wildcard characters: False

-ExcludeVersion

Switch to exclude the version number in the folder path.

Type: System.Management.Automation.SwitchParameter
Parameter Sets: NuGet:PackageByInputObject, NuGet:PackageBySearch
Aliases:

Required: False
Position: Named
Default value: False
Accept pipeline input: False
Accept wildcard characters: False

-Force

Forces the command to run without asking for user confirmation.

Type: System.Management.Automation.SwitchParameter
Parameter Sets: (All)
Aliases:

Required: False
Position: Named
Default value: False
Accept pipeline input: False
Accept wildcard characters: False

-ForceBootstrap

Forces PackageManagement to automatically install the package provider for the specified package.

Type: System.Management.Automation.SwitchParameter
Parameter Sets: (All)
Aliases:

Required: False
Position: Named
Default value: False
Accept pipeline input: False
Accept wildcard characters: False

-InputObject

Accepts pipeline input that specifies the package's SoftwareIdentity object from the `Get-Package` cmdlet. InputObject accepts the SoftwareIdentity object as a `Get-Package` value or a variable that contains the object.

Type: Microsoft.PackageManagement.Packaging.SoftwareIdentity[]
Parameter Sets: PackageByInputObject
Aliases:

Required: True
Position: 0
Default value: None
Accept pipeline input: True (ByValue)
Accept wildcard characters: False

-InstallUpdate

Indicates that `Uninstall-Package` uninstalls updates.

Type: System.Management.Automation.SwitchParameter
Parameter Sets: PowerShellGet:PackageByInputObject, PowerShellGet:PackageBySearch
Aliases:

Required: False
Position: Named
Default value: False
Accept pipeline input: False
Accept wildcard characters: False

-MaximumVersion

Specifies the maximum allowed package version that you want to uninstall. If you don't specify this parameter, `Uninstall-Package` uninstalls the package's newest version.

Type: System.String
Parameter Sets: PackageBySearch
Aliases:

Required: False
Position: Named
Default value: None
Accept pipeline input: False
Accept wildcard characters: False

-MinimumVersion

Specifies the minimum allowed package version that you want to uninstall. If you don't add this parameter, `Uninstall-Package` uninstalls the package's newest version that satisfies any version specified by the MaximumVersion parameter.

Type: System.String
Parameter Sets: PackageBySearch
Aliases:

Required: False
Position: Named
Default value: None
Accept pipeline input: False
Accept wildcard characters: False

-Name

Specifies one or more package names. Multiple package names must be separated by commas.

Type: System.String[]
Parameter Sets: PackageBySearch
Aliases:

Required: True
Position: 0
Default value: None
Accept pipeline input: False
Accept wildcard characters: False

-NoPathUpdate

NoPathUpdate only applies to the `Install-Script` cmdlet. NoPathUpdate is a dynamic parameter added by the provider and isn't supported by `Uninstall-Package`.

Type: System.Management.Automation.SwitchParameter
Parameter Sets: PowerShellGet:PackageByInputObject, PowerShellGet:PackageBySearch
Aliases:

Required: False
Position: Named
Default value: False
Accept pipeline input: False
Accept wildcard characters: False

-PackageManagementProvider

Specifies the PackageManagement provider.

Type: System.String
Parameter Sets: PowerShellGet:PackageByInputObject, PowerShellGet:PackageBySearch
Aliases:

Required: False
Position: Named
Default value: None
Accept pipeline input: False
Accept wildcard characters: False

-ProviderName

Specifies one or more package provider names to search for packages. You can get package provider names by running the `Get-PackageProvider` cmdlet.

Type: System.String[]
Parameter Sets: PackageBySearch
Aliases: Provider
Accepted values: Bootstrap, NuGet, PowerShellGet

Required: False
Position: Named
Default value: None
Accept pipeline input: True (ByPropertyName)
Accept wildcard characters: False

-RequiredVersion

Specifies the exact allowed version of the package that you want to uninstall. If you don't add this parameter, `Uninstall-Package` uninstalls the package's newest version that satisfies any version specified by the MaximumVersion parameter.

Type: System.String
Parameter Sets: PackageBySearch
Aliases:

Required: False
Position: Named
Default value: None
Accept pipeline input: False
Accept wildcard characters: False

-Scope

Specifies the scope for which to uninstall the package. The acceptable values for this parameter are as follows:

  • CurrentUser
  • AllUsers
Type: System.String
Parameter Sets: NuGet:PackageByInputObject, NuGet:PackageBySearch, PowerShellGet:PackageByInputObject, PowerShellGet:PackageBySearch
Aliases:
Accepted values: CurrentUser, AllUsers

Required: False
Position: Named
Default value: None
Accept pipeline input: False
Accept wildcard characters: False

-SkipDependencies

Skips the uninstallation of software dependencies.

Type: System.Management.Automation.SwitchParameter
Parameter Sets: NuGet:PackageByInputObject, NuGet:PackageBySearch
Aliases:

Required: False
Position: Named
Default value: False
Accept pipeline input: False
Accept wildcard characters: False

-SkipPublisherCheck

Allows you to get a package version that is newer than your installed version. For example, an installed package that is digitally signed by a trusted publisher but a new version isn't digitally signed.

Type: System.Management.Automation.SwitchParameter
Parameter Sets: PowerShellGet:PackageByInputObject, PowerShellGet:PackageBySearch
Aliases:

Required: False
Position: Named
Default value: False
Accept pipeline input: False
Accept wildcard characters: False

-Type

Specifies whether to search for packages with a module, a script, or both. The acceptable values for this parameter are as follows:

  • Module
  • Script
  • All
Type: System.String
Parameter Sets: PowerShellGet:PackageByInputObject, PowerShellGet:PackageBySearch
Aliases:
Accepted values: Module, Script, All

Required: False
Position: Named
Default value: None
Accept pipeline input: False
Accept wildcard characters: False

-Confirm

Prompts you for confirmation before running the cmdlet.

Type: System.Management.Automation.SwitchParameter
Parameter Sets: (All)
Aliases: cf

Required: False
Position: Named
Default value: False
Accept pipeline input: False
Accept wildcard characters: False

-WhatIf

Shows what would happen if `Uninstall-Package` cmdlet is run. The cmdlet isn't run.

Type: System.Management.Automation.SwitchParameter
Parameter Sets: (All)
Aliases: wi

Required: False
Position: Named
Default value: False
Accept pipeline input: False
Accept wildcard characters: False

CommonParameters

This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. For more information, see about_CommonParameters.

INPUTS

SoftwareIdentity

`Uninstall-Package` accepts SoftwareIdentity objects from the pipeline as input.

OUTPUTS

SoftwareIdentity

`Uninstall-Package` returns a SoftwareIdentity object for each package uninstalled.

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. For example, `Uninstall-Package` has the PowerShellGet parameter set that includes `-NoPathUpdate`, `AllowClobber`, and `SkipPublisherCheck`.

about_PackageManagement

Find-Package

Get-Package

Install-Package

Save-Package

Back to top