4
我们在一个部署PowerShell脚本中使用了一些PowerShell模块。使用以下命令,我们将模块(即XXXX)安装到“C:\ Program Files \ WindowsPowerShell \ Modules”中。PowerShell 5.1 - 如何卸载当前使用的模块
Install-Module -Name "XXXX" -AllowClobber -RequiredVersion "XXXX" -Repository "XXXX" -Scope AllUsers
现在,我们使用了这个模块的功能,我们使用以下命令在部署脚本的末尾卸载它。
Remove-Module -Name "XXXX" -force
Uninstall-Module -Name "XXXX" -AllVersions -force
但是,这个卸载模块命令给出了以下错误。
WARNING: The version '###' of module 'XXXX' is currently in use. Retry the operation after closing the
applications.
PackageManagement\Uninstall-Package : Module 'XXXX' is in currently in use.
At C:\Program Files\WindowsPowerShell\Modules\PowerShellGet\1.0.0.1\PSModule.psm1:2046 char:21
+ ... $null = PackageManagement\Uninstall-Package @PSBoundParameters
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : InvalidOperation: (Microsoft.Power...ninstallPackage:UninstallPackage) [Uninstall-Packag
e], Exception
+ FullyQualifiedErrorId : ModuleIsInUse,Uninstall-Package,Microsoft.PowerShell.PackageManagement.Cmdlets.Uninstall
Package
有没有人有任何想法解决这个问题?
皇家疼痛在我的背后,但似乎是原因和解决方案。 –