WhiteHorse
WhiteHorse

Reputation: 63

Import powershell module fails

Can somebody explain what did I miss?

I'm trying to import NTFSSecurity PowerShell module.
The folder is extracted at C:\Windows\system32\WindowsPowerShell\v1.0\Modules\, and I've also changed the execution policy.

I'm still receiving the following error: My system is running on the Windows 2008R2 operating system with PowerShell 2.0 installed

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

Upvotes: 2

Views: 5891

Answers (2)

Anurag Kunchamwar
Anurag Kunchamwar

Reputation: 1

My issue was I was seeing this errors only during the azure devops pipeline deployment and so, I tried uninstall and re-install az modules and removed azurerm but nothing worked till I installed powershell 7.4.1

Upvotes: 0

Raf
Raf

Reputation: 10107

Run your shell as administrator(elevated prompt) and unblock all the files in NTFSSecurity folder.

Upvotes: 1

Related Questions