The Uninstall-Package cmdlet uninstalls one or more software packages from the local computer. To
find installed packages, use the Get-Package cmdlet.
Important
The commands contained in the PackageManagement module are different than the commands
provided by the NuGet module in the Package Manager Console of Visual Studio. Each module has
commands that are not available in the other. Commands with the same name differ in their specific
arguments. For more information, see the PowerShell reference documentation for the
Package Manager Console of Visual Studio.
例
Example 1: Uninstall a package
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
Example 2: Use the pipeline to uninstall a package
Get-Package locates a specific package and sends the SoftwareIdentity object down the pipeline
to the Uninstall-Package cmdlet.
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:
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.
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.
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.
NoPathUpdate only applies to the Install-Script cmdlet. NoPathUpdate is a dynamic
parameter added by the provider and isn't supported by Uninstall-Package.
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.
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.
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.
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.