导入powershell模块失败

问题描述 投票:0回答:2

有人可以解释一下我错过了什么吗?

我正在尝试导入

NTFSSecurity
PowerShell 模块。
该文件夹在
C:\Windows\system32\WindowsPowerShell\v1.0\Modules\
解压,我还更改了执行策略。

我仍然收到以下错误: 我的系统运行在 Windows 2008R2 操作系统上,并安装了 PowerShell 2.0

PS C:\Users\admin> $env:PSModulePath
C:\Users\admin\Documents\WindowsPowerShell\Modules;C:\Windows\system32\WindowsPowerShell\v1.0\Modules\

PS C:\Users\admin> get-module -ListAvailable -all

ModuleType Name                      ExportedCommands
---------- ----                      ----------------
Binary     PrivilegeControl          {}
Binary     ProcessPrivileges         {}
Binary     Security2                 {}
Manifest   ADRMS                     {}
Manifest   AppLocker                 {}
Manifest   BestPractices             {}
Binary     Microsoft.BestPractice... {}
Manifest   BitsTransfer              {}
Binary     Microsoft.BackgroundIn... {}
Binary     NTFSSecurity              {}
Manifest   NTFSSecurity              {}
Binary     PrivilegeControl          {}
Binary     ProcessPrivileges         {}
Binary     Security2                 {}
Manifest   PSDiagnostics             {}
Script     PSDiagnostics             {}
Manifest   ServerManager             {}
Manifest   TroubleshootingPack       {}

PS C:\Users\admin> import-module NTFSSecurity
Import-Module : The specified module 'NTFSSecurity' was not loaded because no valid module file was found in any module
 directory.
At line:1 char:14
+ import-module <<<<  NTFSSecurity
    + CategoryInfo          : ResourceUnavailable: (NTFSSecurity:String) [Import-Module], FileNotFoundException
    + FullyQualifiedErrorId : Modules_ModuleNotFound,Microsoft.PowerShell.Commands.ImportModuleCommand
powershell import module
2个回答
1
投票

以管理员身份运行 shell(提升的提示符)并取消阻止 NTFSSecurity 文件夹中的所有文件。


0
投票

我的问题是我仅在 azure devops 管道部署期间看到此错误,因此,我尝试卸载并重新安装 az 模块并删除 azurerm,但在安装 powershell 7.4.1 之前没有任何效果

© www.soinside.com 2019 - 2024. All rights reserved.