Uninstall-Module
Uninstalls a module.
語法
NameParameterSet (預設值)
Uninstall-Module
[-Name] <String[]>
[-MinimumVersion <String>]
[-RequiredVersion <String>]
[-MaximumVersion <String>]
[-AllVersions]
[-Force]
[-AllowPrerelease]
[-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 other modules depend on it or the module wasn't installed with the
Install-Module
cmdlet.
You can manually delete module files, but doing so may break any modules that depend on the deleted module.
The parameters that take module version numbers expect strings formatted as version numbers.
- Standard version numbers have a format of
x.y.z
where x, y, and z are numbers - Prerelease versions have a format of
x.y.z-<prerelease_label>
where the<prerelease_label>
is arbitrary string assigned to that release.
範例
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.
參數
-AllowPrerelease
Allows you to uninstall a module marked as a prerelease.
參數屬性
類型: | SwitchParameter |
預設值: | None |
支援萬用字元: | False |
不要顯示: | False |
參數集
NameParameterSet
Position: | Named |
必要: | False |
來自管線的值: | False |
來自管線按屬性名稱的值: | False |
來自剩餘引數的值: | False |
-AllVersions
Specifies that you want to include all available versions of a module. You can't use the AllVersions parameter with the MinimumVersion, MaximumVersion, or RequiredVersion parameters.
參數屬性
類型: | SwitchParameter |
預設值: | None |
支援萬用字元: | False |
不要顯示: | False |
參數集
NameParameterSet
Position: | Named |
必要: | False |
來自管線的值: | False |
來自管線按屬性名稱的值: | False |
來自剩餘引數的值: | False |
-Confirm
Prompts you for confirmation before running the Uninstall-Module
.
參數屬性
類型: | SwitchParameter |
預設值: | False |
支援萬用字元: | False |
不要顯示: | False |
別名: | cf |
參數集
(All)
Position: | Named |
必要: | False |
來自管線的值: | False |
來自管線按屬性名稱的值: | False |
來自剩餘引數的值: | False |
-Force
Forces Uninstall-Module
to run without asking for user confirmation.
參數屬性
類型: | SwitchParameter |
預設值: | None |
支援萬用字元: | False |
不要顯示: | False |
參數集
(All)
Position: | Named |
必要: | False |
來自管線的值: | False |
來自管線按屬性名稱的值: | False |
來自剩餘引數的值: | False |
-InputObject
Accepts a PSRepositoryItemInfo object. For example, output Get-InstalledModule
to a variable
and use that variable as the InputObject argument.
參數屬性
類型: | PSObject[] |
預設值: | None |
支援萬用字元: | False |
不要顯示: | False |
參數集
InputObject
Position: | 0 |
必要: | True |
來自管線的值: | True |
來自管線按屬性名稱的值: | True |
來自剩餘引數的值: | 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.
參數屬性
類型: | String |
預設值: | None |
支援萬用字元: | False |
不要顯示: | False |
參數集
NameParameterSet
Position: | Named |
必要: | False |
來自管線的值: | False |
來自管線按屬性名稱的值: | True |
來自剩餘引數的值: | False |
-MinimumVersion
Specifies the minimum version of the module to uninstall. The MinimumVersion and RequiredVersion parameters can't be used in the same command.
參數屬性
類型: | String |
預設值: | None |
支援萬用字元: | False |
不要顯示: | False |
參數集
NameParameterSet
Position: | Named |
必要: | False |
來自管線的值: | False |
來自管線按屬性名稱的值: | True |
來自剩餘引數的值: | False |
-Name
Specifies an array of module names to uninstall.
參數屬性
類型: | String[] |
預設值: | None |
支援萬用字元: | False |
不要顯示: | False |
參數集
NameParameterSet
Position: | 0 |
必要: | True |
來自管線的值: | False |
來自管線按屬性名稱的值: | True |
來自剩餘引數的值: | False |
-RequiredVersion
Specifies the exact version number of the module to uninstall.
參數屬性
類型: | String |
預設值: | None |
支援萬用字元: | False |
不要顯示: | False |
參數集
NameParameterSet
Position: | Named |
必要: | False |
來自管線的值: | False |
來自管線按屬性名稱的值: | True |
來自剩餘引數的值: | False |
-WhatIf
Shows what would happen if Uninstall-Module
runs. The cmdlet isn't run.
參數屬性
類型: | SwitchParameter |
預設值: | False |
支援萬用字元: | False |
不要顯示: | False |
別名: | wi |
參數集
(All)
Position: | Named |
必要: | False |
來自管線的值: | False |
來自管線按屬性名稱的值: | False |
來自剩餘引數的值: | 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.