Rob*_*err 3 windows powershell
如何卸载模块以使 Get-Module 不再报告已找到该模块?
> Get-Module -list -Name Pester
ModuleType Version Name
---------- ------- ----
Script 3.4.0 Pester
> Uninstall-Module -Name Pester
PackageManagement\Uninstall-Package : No match was found for the specified search criteria and module names 'Pester'.
Run Code Online (Sandbox Code Playgroud)
小智 5
以下内容很好地删除了 pester 3.4.0。
以下需要使用参数运行-RunAsAdministrator:
$modulePath = "C:\Program Files\WindowsPowerShell\Modules\Pester"
if (-not (Test-Path $modulePath)) {
"There is no Pester folder in $modulePath, doing nothing."
break
}
takeown /F $modulePath /A /R
icacls $modulePath /reset
icacls $modulePath /grant Administrators:'F' /inheritance:d /T
Remove-Item -Path $modulePath -Recurse -Force -Confirm:$false
Run Code Online (Sandbox Code Playgroud)
解决方案取自GitHUB。
然后我能够运行以下...
Install-Module Pester -Force -Scope CurrentUser
Run Code Online (Sandbox Code Playgroud)
...然后验证。
PS:
输出为C:\WINDOWS\system32> get-installedmodule:
Version Name Repository Description
------- ---- ---------- -----------
1.1.183.17 MSOnline PSGallery Microsoft Azure Active Directory Module for Wind...
4.9.0 Pester PSGallery Pester provides a framework for running BDD styl...
Run Code Online (Sandbox Code Playgroud)
希望有帮助:)
| 归档时间: |
|
| 查看次数: |
6271 次 |
| 最近记录: |