| external help file | Microsoft.PowerShell.PackageManagement.dll-Help.xml |
|---|---|
| Locale | en-US |
| Module Name | PackageManagement |
| ms.date | 12/12/2022 |
| online version | https://learn.microsoft.com/powershell/module/packagemanagement/uninstall-package?view=powershellget-2.x&WT.mc_id=ps-gethelp |
| schema | 2.0.0 |
| title | Uninstall-Package |
Uninstalls one or more software packages.
Uninstall-Package [-InputObject] <SoftwareIdentity[]> [-AllVersions] [-Force] [-ForceBootstrap]
[-WhatIf] [-Confirm] [<CommonParameters>]
Uninstall-Package [-Name] <String[]> [-RequiredVersion <String>] [-MinimumVersion <String>]
[-MaximumVersion <String>] [-AllVersions] [-Force] [-ForceBootstrap] [-WhatIf] [-Confirm]
[-ProviderName <String[]>] [<CommonParameters>]
Uninstall-Package [-AllVersions] [-Force] [-ForceBootstrap] [-WhatIf] [-Confirm]
[-Destination <String>] [-ExcludeVersion] [-Scope <String>] [-SkipDependencies]
[<CommonParameters>]
Uninstall-Package [-AllVersions] [-Force] [-ForceBootstrap] [-WhatIf] [-Confirm]
[-Destination <String>] [-ExcludeVersion] [-Scope <String>] [-SkipDependencies]
[<CommonParameters>]
Uninstall-Package [-AllVersions] [-Force] [-ForceBootstrap] [-WhatIf] [-Confirm] [-Scope <String>]
[-PackageManagementProvider <String>] [-Type <String>] [-AllowClobber] [-SkipPublisherCheck]
[-InstallUpdate] [-NoPathUpdate] [-AllowPrereleaseVersions] [<CommonParameters>]
Uninstall-Package [-AllVersions] [-Force] [-ForceBootstrap] [-WhatIf] [-Confirm] [-Scope <String>]
[-PackageManagementProvider <String>] [-Type <String>] [-AllowClobber] [-SkipPublisherCheck]
[-InstallUpdate] [-NoPathUpdate] [-AllowPrereleaseVersions] [<CommonParameters>]
The Uninstall-Package cmdlet uninstalls one or more software packages from the local computer. To
find installed packages, use the Get-Package cmdlet.
[!INCLUDE nuget-module]
The Uninstall-Package cmdlet uninstalls packages. The Name parameter specifies the package to
uninstall. If multiple versions of a package are installed, the newest version is uninstalled.
PS> Uninstall-Package -Name NuGet.Core
Get-Package locates a specific package and sends the SoftwareIdentity object down the pipeline
to the Uninstall-Package cmdlet.
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 )
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: None
Accept pipeline input: False
Accept wildcard characters: FalseAllows 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: None
Accept pipeline input: False
Accept wildcard characters: FalseIndicates that this cmdlet uninstalls all versions of the package.
Type: System.Management.Automation.SwitchParameter
Parameter Sets: (All)
Aliases:
Required: False
Position: Named
Default value: None
Accept pipeline input: False
Accept wildcard characters: FalseSpecifies 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: FalseSwitch 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: None
Accept pipeline input: False
Accept wildcard characters: FalseForces the command to run without asking for user confirmation.
Type: System.Management.Automation.SwitchParameter
Parameter Sets: (All)
Aliases:
Required: False
Position: Named
Default value: None
Accept pipeline input: False
Accept wildcard characters: FalseForces 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: None
Accept pipeline input: False
Accept wildcard characters: FalseAccepts 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: FalseIndicates that Uninstall-Package uninstalls updates.
Type: System.Management.Automation.SwitchParameter
Parameter Sets: PowerShellGet:PackageByInputObject, PowerShellGet:PackageBySearch
Aliases:
Required: False
Position: Named
Default value: None
Accept pipeline input: False
Accept wildcard characters: FalseSpecifies 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: FalseSpecifies 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: FalseSpecifies 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: FalseNoPathUpdate 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: None
Accept pipeline input: False
Accept wildcard characters: FalseSpecifies 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: FalseSpecifies 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: FalseSpecifies 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: FalseSpecifies 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: FalseSkips the uninstallation of software dependencies.
Type: System.Management.Automation.SwitchParameter
Parameter Sets: NuGet:PackageByInputObject, NuGet:PackageBySearch
Aliases:
Required: False
Position: Named
Default value: None
Accept pipeline input: False
Accept wildcard characters: FalseAllows 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: None
Accept pipeline input: False
Accept wildcard characters: FalseSpecifies 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: FalsePrompts 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: FalseShows 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: FalseThis cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. For more information, see about_CommonParameters.
You can pipe SoftwareIdentity objects to this cmdlet.
This cmdlet returns a SoftwareIdentity object for each package uninstalled.
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.