Share via


Uninstall-Module

Uninstalls a module.

Syntax

NameParameterSet (Default)

Uninstall-Module
    [-Name] <String[]>
    [-MinimumVersion <Version>]
    [-RequiredVersion <Version>]
    [-MaximumVersion <Version>]
    [-Force]
    [-WhatIf]
    [-Confirm]
    [<CommonParameters>]

InputObject

Uninstall-Module
    [-InputObject] <PSObject[]>
    [-Force]
    [-WhatIf]
    [-Confirm]
    [<CommonParameters>]

Description

The Uninstall-Module cmdlet uninstalls a specified module from the local computer. You can't uninstall a module if it has other modules as dependencies.

Examples

Example 1: Uninstall a module

This example uninstalls a module.

Uninstall-Module -Name SpeculationControl

Uninstall-Module uses the Name parameter to specify the module to uninstall from the local computer.

Example 2: Use the pipeline to uninstall a module

In this example, the pipeline is used to uninstall a module.

Get-InstalledModule -Name SpeculationControl | Uninstall-Module

Get-InstalledModule uses the Name parameter to specify the module. The object is sent down the pipeline to Uninstall-Module and is uninstalled.

Parameters

-Confirm

Prompts you for confirmation before running the Uninstall-Module.

Parameter properties

Type:SwitchParameter
Default value:False
Supports wildcards:False
DontShow:False
Aliases:cf

Parameter sets

(All)
Position:Named
Mandatory:False
Value from pipeline:False
Value from pipeline by property name:False
Value from remaining arguments:False

-Force

Forces Uninstall-Module to run without asking for user confirmation.

Parameter properties

Type:SwitchParameter
Default value:None
Supports wildcards:False
DontShow:False

Parameter sets

(All)
Position:Named
Mandatory:False
Value from pipeline:False
Value from pipeline by property name:False
Value from remaining arguments:False

-InputObject

Accepts a PSRepositoryItemInfo object. For example, output Get-InstalledModule to a variable and use that variable as the InputObject argument.

Parameter properties

Type:

PSObject[]

Default value:None
Supports wildcards:False
DontShow:False

Parameter sets

InputObject
Position:0
Mandatory:True
Value from pipeline:True
Value from pipeline by property name:True
Value from remaining arguments:False

-MaximumVersion

Specifies the maximum, or newest, version of the module to uninstall. The MaximumVersion and RequiredVersion parameters can't be used in the same command.

Parameter properties

Type:Version
Default value:None
Supports wildcards:False
DontShow:False

Parameter sets

NameParameterSet
Position:Named
Mandatory:False
Value from pipeline:False
Value from pipeline by property name:True
Value from remaining arguments:False

-MinimumVersion

Specifies the minimum version of the module to uninstall. The MinimumVersion and RequiredVersion parameters can't be used in the same command.

Parameter properties

Type:Version
Default value:None
Supports wildcards:False
DontShow:False

Parameter sets

NameParameterSet
Position:Named
Mandatory:False
Value from pipeline:False
Value from pipeline by property name:True
Value from remaining arguments:False

-Name

Specifies an array of module names to uninstall.

Parameter properties

Type:

String[]

Default value:None
Supports wildcards:False
DontShow:False

Parameter sets

NameParameterSet
Position:0
Mandatory:True
Value from pipeline:False
Value from pipeline by property name:True
Value from remaining arguments:False

-RequiredVersion

Specifies the exact version number of the module to uninstall.

Parameter properties

Type:Version
Default value:None
Supports wildcards:False
DontShow:False

Parameter sets

NameParameterSet
Position:Named
Mandatory:False
Value from pipeline:False
Value from pipeline by property name:True
Value from remaining arguments:False

-WhatIf

Shows what would happen if Uninstall-Module runs. The cmdlet isn't run.

Parameter properties

Type:SwitchParameter
Default value:False
Supports wildcards:False
DontShow:False
Aliases:wi

Parameter sets

(All)
Position:Named
Mandatory:False
Value from pipeline:False
Value from pipeline by property name:False
Value from remaining arguments: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.

Inputs

PSRepositoryItemInfo

Uninstall-Module accepts PSRepositoryItemInfo objects from the pipeline.