如何卸载 PowerShell 模块?
要卸载 PowerShell 模块,我们可以直接使用 Uninstall-Module 命令,但模块不应该处于使用状态,否则会抛出错误。
当我们使用 Uninstall-Module 命令时,它可以从当前用户配置文件或所有用户配置文件中卸载模块。
Uninstall-Module 7Zip4PowerShell -Force -Verbose
另一种方法,
Get-InstalledModule 7Zip4Powershell | Uninstall-Module -Force -Verbose
如果在 PowerShell 中安装了同一模块的多个版本,并且想要卸载所有版本,则使用-AllVersions 参数。
Uninstall-Module 7Zip4PowerShell -AllVersions -Force -Verbose
如果要卸载特定版本,可以使用 -RequiredVersion。
Uninstall-Module 7Zip4PowerShell -RequiredVersion 1.5.0 -Force -Verbose
要在远程计算机上卸载,请使用 Invoke-Command 方法。
Invoke-Command -ComputerName RemoteComputer1 -ScriptBlock {
Uninstall-Module 7Zip4PowerShell -RequiredVersion 1.5.0 -Force -Verbose
}
广告
数据结构
网络
关系型数据库
操作系统
Java
iOS
HTML
CSS
Android
Python
C 编程语言
C++
C#
MongoDB
MySQL
JavaScript
PHP