Uninstall-Module
卸载模块。
语法
Uninstall-Module
[-Name] <String[]>
[-MinimumVersion <Version>]
[-RequiredVersion <Version>]
[-MaximumVersion <Version>]
[-Force]
[-WhatIf]
[-Confirm]
[<CommonParameters>]
Uninstall-Module
[-InputObject] <PSObject[]>
[-Force]
[-WhatIf]
[-Confirm]
[<CommonParameters>]
说明
Uninstall-Module
cmdlet 从本地计算机卸载指定的模块。 如果模块具有其他模块作为依赖项,则无法卸载该模块。
示例
示例 1:卸载模块
此示例卸载模块。
Uninstall-Module -Name SpeculationControl
Uninstall-Module
使用 Name 参数指定要从本地计算机中卸载的模块。
示例 2:使用管道卸载模块
在此示例中,管道用于卸载模块。
Get-InstalledModule -Name SpeculationControl | Uninstall-Module
Get-InstalledModule
使用 Name 参数来指定模块。 对象将管道向下发送到 Uninstall-Module
并卸载。
参数
-Confirm
在运行 Uninstall-Module
之前,提示你进行确认。
类型: | SwitchParameter |
别名: | cf |
Position: | Named |
默认值: | False |
必需: | False |
接受管道输入: | False |
接受通配符: | False |
-Force
强制 Uninstall-Module
运行而不要求用户确认。
类型: | SwitchParameter |
Position: | Named |
默认值: | None |
必需: | False |
接受管道输入: | False |
接受通配符: | False |
-InputObject
接受 PSRepositoryItemInfo 对象。 例如,输出 Get-InstalledModule
变量,并将该变量用作 InputObject 参数。
类型: | PSObject[] |
Position: | 0 |
默认值: | None |
必需: | True |
接受管道输入: | True |
接受通配符: | False |
-MaximumVersion
指定要卸载的模块的最大版本或最新版本。 MaximumVersion 和 RequiredVersion 参数不能在同一命令中使用。
类型: | Version |
Position: | Named |
默认值: | None |
必需: | False |
接受管道输入: | True |
接受通配符: | False |
-MinimumVersion
指定要卸载的模块的最低版本。 MinimumVersion 和 RequiredVersion 参数不能在同一命令中使用。
类型: | Version |
Position: | Named |
默认值: | None |
必需: | False |
接受管道输入: | True |
接受通配符: | False |
-Name
指定要卸载的模块名称数组。
类型: | String[] |
Position: | 0 |
默认值: | None |
必需: | True |
接受管道输入: | True |
接受通配符: | False |
-RequiredVersion
指定要卸载的模块的确切版本号。
类型: | Version |
Position: | Named |
默认值: | None |
必需: | False |
接受管道输入: | True |
接受通配符: | False |
-WhatIf
显示 Uninstall-Module
运行时会发生什么情况。 该 cmdlet 未运行。
类型: | SwitchParameter |
别名: | wi |
Position: | Named |
默认值: | False |
必需: | False |
接受管道输入: | False |
接受通配符: | False |
输入
PSRepositoryItemInfo
Uninstall-Module
接受管道中的 PSRepositoryItemInfo 对象。