PowerShell Commands

Uninstall-Package

Uninstall-Package [-AdditionalArguments <String[]>] [-AllVersions] [-Confirm] [-Force] [-ForceBootstrap] [-WhatIf][<CommonParameters>]
Uninstall-Package [-AdditionalArguments <String[]>] [-AllVersions] [-Confirm] [-Force] [-ForceBootstrap] [-WhatIf][<CommonParameters>]
Uninstall-Package [-AllVersions] [-AllowClobber] [-Confirm] [-Force] [-ForceBootstrap] [-InstallUpdate][-NoPathUpdate] [-PackageManagementProvider <String>] [-Scope {CurrentUser | AllUsers}] [-SkipPublisherCheck][-Type {Module | Script | All}] [-WhatIf] [<CommonParameters>]
Uninstall-Package [-AllVersions] [-AllowClobber] [-Confirm] [-Force] [-ForceBootstrap] [-InstallUpdate][-NoPathUpdate] [-PackageManagementProvider <String>] [-Scope {CurrentUser | AllUsers}] [-SkipPublisherCheck][-Type {Module | Script | All}] [-WhatIf] [<CommonParameters>]
Uninstall-Package [-AllVersions] [-Confirm] [-Destination <String>] [-ExcludeVersion] [-Force] [-ForceBootstrap][-Scope {CurrentUser | AllUsers}] [-SkipDependencies] [-WhatIf] [<CommonParameters>]
Uninstall-Package [-AllVersions] [-Confirm] [-Destination <String>] [-ExcludeVersion] [-Force] [-ForceBootstrap][-Scope {CurrentUser | AllUsers}] [-SkipDependencies] [-WhatIf] [<CommonParameters>]
Uninstall-Package [-AllVersions] [-Confirm] [-Force] [-ForceBootstrap] [-IncludeSystemComponent][-IncludeWindowsInstaller] [-WhatIf] [<CommonParameters>]
Uninstall-Package [-AllVersions] [-Confirm] [-Force] [-ForceBootstrap] [-IncludeSystemComponent][-IncludeWindowsInstaller] [-WhatIf] [<CommonParameters>]
Uninstall-Package [-InputObject*] <SoftwareIdentity[]> [-AllVersions] [-Confirm] [-Force] [-ForceBootstrap][-WhatIf] [<CommonParameters>]
Uninstall-Package [-Name*] <String[]> [-AllVersions] [-Confirm] [-Force] [-ForceBootstrap] [-MaximumVersion<String>] [-MinimumVersion <String>] [-ProviderName {msi | NuGet | msu | Programs | PowerShellGet | psl |chocolatey}] [-RequiredVersion <String>] [-WhatIf] [<CommonParameters>]

The Uninstall-Package cmdlet uninstalls one or more software packages from the local computer.

Parameters

-AdditionalArguments <String[]>

  • Default value is None
  • Accepts pipeline input False

Specifies additional arguments.

-AllVersions [<SwitchParameter>]

  • Default value is False
  • Accepts pipeline input False

Indicates that this cmdlet uninstalls all versions of the package.

-AllowClobber [<SwitchParameter>]

  • Default value is False
  • Accepts pipeline input False

@{Text=}

-Confirm [<SwitchParameter>]

  • Default value is False
  • Accepts pipeline input False

Prompts you for confirmation before running the cmdlet.

-Destination <String>

  • Default value is None
  • Accepts pipeline input False

{{Fill Destination Description}}

-ExcludeVersion [<SwitchParameter>]

  • Default value is False
  • Accepts pipeline input False

{{Fill ExcludeVersion Description}}

-Force [<SwitchParameter>]

  • Default value is False
  • Accepts pipeline input False

Forces the command to run without asking for user confirmation.

-ForceBootstrap [<SwitchParameter>]

  • Default value is False
  • Accepts pipeline input False

Forces Package Management to automatically install the package provider for the specified package.

-IncludeSystemComponent [<SwitchParameter>]

  • Default value is False
  • Accepts pipeline input False

Specifies that this cmdlet uninstalls system components.

-IncludeWindowsInstaller [<SwitchParameter>]

  • Default value is False
  • Accepts pipeline input False

Indicates that this cmdlet uninstalls the package through Windows Installer.

-InputObject <SoftwareIdentity[]>

  • This value is required
  • Default value is None
  • Accepts pipeline input ByValue

Specifies a package by using the package's SoftwareIdentity type, which is shown in the results of the Get-Package cmdlet.

-InstallUpdate [<SwitchParameter>]

  • Default value is False
  • Accepts pipeline input False

Indicates that this cmdlet uninstalls updates.

-MaximumVersion <String>

  • Default value is None
  • Accepts pipeline input False

Specifies the maximum allowed version of the package that you want to uninstall. If you do not specify this parameter, this cmdlet uninstalls the highest-numbered available version of the package on the computer.

-MinimumVersion <String>

  • Default value is None
  • Accepts pipeline input False

Specifies the minimum allowed version of the package that you want to uninstall. If you do not add this parameter, Uninstall-Package uninstalls the newest available version of the package that also satisfies any maximum version specified by the MaximumVersion parameter.

-Name <String[]>

  • This value is required
  • Default value is None
  • Accepts pipeline input False

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

-NoPathUpdate [<SwitchParameter>]

  • Default value is False
  • Accepts pipeline input False

@{Text=}

-PackageManagementProvider <String>

  • Default value is None
  • Accepts pipeline input False

Specifies the Package Management provider.

-ProviderName <String[]>

  • Default value is None
  • Accepts pipeline input ByPropertyName

Specifies one or more package provider names to which to scope your package search. You can get package provider names by running the Get-PackageProvider cmdlet.

-RequiredVersion <String>

  • Default value is None
  • Accepts pipeline input False

Specifies the exact allowed version of the package that you want to uninstall. If you do not add this parameter, this cmdlet installs the newest available version of the package (subject to any maximum specified version, if you've added the MaximumVersion parameter).

-Scope <String>

  • Default value is None
  • Accepts pipeline input False

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

- CurrentUser

- AllUsers

-SkipDependencies [<SwitchParameter>]

  • Default value is False
  • Accepts pipeline input False

{{Fill SkipDependencies Description}}

-SkipPublisherCheck [<SwitchParameter>]

  • Default value is False
  • Accepts pipeline input False

@{Text=}

-Type <String>

  • Default value is None
  • Accepts pipeline input False

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

- Module

- Script

- All

-WhatIf [<SwitchParameter>]

  • Default value is False
  • Accepts pipeline input False

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. Uninstall a package:
    PS C:\> Uninstall-Package -Name "DSCAccelerator"
    

    This command uninstalls a package named DSCAccelerator.

  2. Uninstall a package by piping results of Get-Package:
    PS C:\> Get-Package -Name "DSCAccelerator" -RequiredVersion "2.1.2" | Uninstall-Package -Force
    

    This command uninstalls a package named DSCAccelerator by first locating the exact package with the Get-Package cmdlet, then piping the results of Get-Package to the Uninstall-Package cmdlet. The Force parameter ensures that you are not prompted to confirm that you want to uninstall the package.

Additional Notes

This work is licensed under a Creative Commons Attribution 4.0 International. It is attributed to Microsoft Corporation and can be found here.

PowerShell Commands