如何卸载PowerShell模块?

阅读 1596 收藏 0 点赞 0 评论 0

要卸载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
}

评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号