Compartir a través de


Uninstall-PSResource

Uninstalls a resource that was installed using PowerShellGet.

Sintaxis

NameParameterSet (Es el valor predeterminado).

Uninstall-PSResource
    [-Name] <String[]>
    [-Version <String>]
    [-Prerelease]
    [-SkipDependencyCheck]
    [-Scope <ScopeType>]
    [-WhatIf]
    [-Confirm]
    [<CommonParameters>]

InputObjectParameterSet

Uninstall-PSResource
    [-InputObject] <PSResourceInfo[]>
    [-Prerelease]
    [-SkipDependencyCheck]
    [-Scope <ScopeType>]
    [-WhatIf]
    [-Confirm]
    [<CommonParameters>]

Description

This cmdlet combines the functionality of the Uninstall-Module and Uninstall-Script cmdlets from PowerShellGet v2. The cmdlet searches the package installation paths for resources that have the PowerShellGet XML metadata file. Matching resources are uninstalled from the system.

By default, the cmdlet checks to see whether the resource being removed is a dependency for another resource.

Ejemplos

Example 1

Uninstall the latest version of the Az module.

Uninstall-PSResource Az

Example 2

Uninstall a specific version of the Az module.

Uninstall-PSResource -name Az -version "5.0.0"

Example 3

Uninstalls all versions of the Az module within the specified version range.

Uninstall-PSResource -name Az -version "(5.0.0, 7.5.0)"

Example 4

This example assumes that the following versions of Az module are already installed:

  • 4.0.1-preview
  • 4.1.0
  • 4.0.2-preview

The Uninstall-PSResource cmdlet removes stable and prerelease version that fall within the version range specified. Per NuGetVersion rules, a prerelease version is less than a stable version, so 4.0.1-preview is actually less than the 4.0.1 version in the specified range. Therefore, 4.0.1-preview isn't removed. Versions 4.1.0 and 4.0.2-preview are removed because they fall within the range.

Uninstall-PSResource -name Az -version "[4.0.1, 4.1.0]"

Example 5

This example assumes that the following versions of Az module are already installed:

  • 4.0.1-preview
  • 4.1.0
  • 4.0.2-preview

This is the same as the previous example except the Prerelease parameter means that only prerelease versions are removed. Only version 4.0.2-preview is removed because version 4.0.1-preview is outside the range and version 4.1.0 isn't a prerelease version.

Uninstall-PSResource -name Az -version "[4.0.1, 4.1.0]" -Prerelease

Parámetros

-Confirm

Prompts you for confirmation before running the cmdlet.

Propiedades del parámetro

Tipo:SwitchParameter
Valor predeterminado:False
Admite caracteres comodín:False
DontShow:False
Alias:cf

Conjuntos de parámetros

(All)
Posición:Named
Mandatory:False
Valor de la canalización:False
Valor de la canalización por nombre de propiedad:False
Valor de los argumentos restantes:False

-InputObject

Used for pipeline input.

Propiedades del parámetro

Tipo:

Microsoft.PowerShell.PSResourceGet.UtilClasses.PSResourceInfo[]

Valor predeterminado:None
Admite caracteres comodín:False
DontShow:False

Conjuntos de parámetros

InputObjectParameterSet
Posición:0
Mandatory:True
Valor de la canalización:True
Valor de la canalización por nombre de propiedad:False
Valor de los argumentos restantes:False

-Name

Name of a resource or resources to remove. Wildcards are supported but NuGet only accepts the * character.

Propiedades del parámetro

Tipo:

String[]

Valor predeterminado:None
Admite caracteres comodín:True
DontShow:False

Conjuntos de parámetros

NameParameterSet
Posición:0
Mandatory:True
Valor de la canalización:True
Valor de la canalización por nombre de propiedad:False
Valor de los argumentos restantes:False

-Prerelease

Indicates that only prerelease version resources should be removed.

Propiedades del parámetro

Tipo:SwitchParameter
Valor predeterminado:False
Admite caracteres comodín:False
DontShow:False

Conjuntos de parámetros

(All)
Posición:Named
Mandatory:False
Valor de la canalización:False
Valor de la canalización por nombre de propiedad:False
Valor de los argumentos restantes:False

-Scope

Specifies the scope of the resource to uninstall.

Propiedades del parámetro

Tipo:Microsoft.PowerShell.PSResourceGet.UtilClasses.ScopeType
Valor predeterminado:None
Valores aceptados:CurrentUser, AllUsers
Admite caracteres comodín:False
DontShow:False

Conjuntos de parámetros

(All)
Posición:Named
Mandatory:False
Valor de la canalización:False
Valor de la canalización por nombre de propiedad:False
Valor de los argumentos restantes:False

-SkipDependencyCheck

By default, the cmdlet checks to see whether the resource being removed is a dependency for another resource. Using this parameter skips the dependency test.

Propiedades del parámetro

Tipo:SwitchParameter
Valor predeterminado:False
Admite caracteres comodín:False
DontShow:False

Conjuntos de parámetros

(All)
Posición:Named
Mandatory:False
Valor de la canalización:False
Valor de la canalización por nombre de propiedad:False
Valor de los argumentos restantes:False

-Version

Specifies the version of the resource to be removed. The value can be an exact version or a version range using the NuGet versioning syntax.

For more information about NuGet version ranges, see Package versioning.

PowerShellGet supports all but the minimum inclusive version listed in the NuGet version range documentation. Using 1.0.0.0 as the version doesn't yield versions 1.0.0.0 and higher (minimum inclusive range). Instead, the value is considered to be the required version. To search for a minimum inclusive range, use [1.0.0.0, ] as the version range.

Propiedades del parámetro

Tipo:String
Valor predeterminado:None
Admite caracteres comodín:True
DontShow:False

Conjuntos de parámetros

NameParameterSet
Posición:Named
Mandatory:False
Valor de la canalización:False
Valor de la canalización por nombre de propiedad:False
Valor de los argumentos restantes:False

-WhatIf

Shows what would happen if the cmdlet runs. The cmdlet isn't run.

Propiedades del parámetro

Tipo:SwitchParameter
Valor predeterminado:False
Admite caracteres comodín:False
DontShow:False
Alias:wi

Conjuntos de parámetros

(All)
Posición:Named
Mandatory:False
Valor de la canalización:False
Valor de la canalización por nombre de propiedad:False
Valor de los argumentos restantes: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.

Entradas

String

Microsoft.PowerShell.PSResourceGet.UtilClasses.PSResourceInfo

Salidas

Object