Uninstall-Module
Uninstall-Module [-Name*] <String[]> [-AllVersions] [-Confirm] [-Force] [-MaximumVersion <Version>][-MinimumVersion <Version>] [-RequiredVersion <Version>] [-WhatIf] [<CommonParameters>]
Uninstall-Module [-InputObject*] <PSObject[]> [-Confirm] [-Force] [-WhatIf] [<CommonParameters>]
The Uninstall-Module cmdlet uninstalls the specified module from the local computer. You cannot uninstall a module if it has other modules as dependencies.
Parameters
-AllVersions [<SwitchParameter>]
- Default value is False
- Accepts pipeline input False
Specifies that you want to include all available versions of a module. You cannot use the AllVersions parameter with the MinimumVersion , MaximumVersion , or RequiredVersion parameters.
-Confirm [<SwitchParameter>]
- Default value is False
- Accepts pipeline input False
Prompts you for confirmation before running the cmdlet.
-Force [<SwitchParameter>]
- Default value is False
- Accepts pipeline input False
Forces the command to run without asking for user confirmation.
-InputObject <PSObject[]>
- This value is required
- Default value is None
- Accepts pipeline input ByPropertyName
{{Fill InputObject Description}}
-MaximumVersion <Version>
- Default value is None
- Accepts pipeline input ByPropertyName
Specifies the maximum, or newest, version of the module to uninstall. The MaximumVersion and RequiredVersion parameters are mutually exclusive; you cannot use both parameters in the same command.
-MinimumVersion <Version>
- Default value is None
- Accepts pipeline input ByPropertyName
Specifies the minimum version of the script to uninstall. The MinimumVersion and RequiredVersion parameters are mutually exclusive; you cannot use both parameters in the same command.
-Name <String[]>
- This value is required
- Default value is None
- Accepts pipeline input ByPropertyName
Specifies an array of names of modules to uninstall.
-RequiredVersion <Version>
- Default value is None
- Accepts pipeline input ByPropertyName
Specifies the exact version number of the module to uninstall.
-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.
Examples
-
Get a module and uninstall it:
PS C:\> Get-InstalledModule -Name "xPSDesiredStateConfiguration" -RequiredVersion 3.6.0.0 | Uninstall-Module
This command gets version 3.6.0.0 of the module named xPSDesiredStateConfiguration, and then uses the pipeline operator to pass it to the Uninstall-Module cmdlet, which uninstalls it.
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