PSPKI icon indicating copy to clipboard operation
PSPKI copied to clipboard

Import-Module PSPKI always needed

Open Pixelfool opened this issue 3 years ago • 7 comments

When I try to use PSPKI after installing or opening a ne PowerShell instance, I need to load it with Import-Module. I am using Windows Server 2019. It also wont show up in Get-Modules until I import it again.

Pixelfool avatar Sep 01 '20 11:09 Pixelfool

It is expected behavior since Windows PowerShell 5+. PowerShell no longer autoloads the module by simply calling a command from installed and non-loaded module. Use Get-Module -ListAvailable to get a list of installed modules.

Crypt32 avatar Sep 01 '20 12:09 Crypt32

Interesting. Other modules load automatically. Only PSPKI does not

Pixelfool avatar Sep 01 '20 12:09 Pixelfool

How did you install the module? What is your $PSVersionTable? What returns $PSModuleAutoloadingPreference?

Crypt32 avatar Sep 01 '20 12:09 Crypt32

I installed it with "Install-Module -Name PSPKI"

$PSVersionTable:

Name Value


PSVersion 5.1.17763.592 PSEdition Desktop PSCompatibleVersions {1.0, 2.0, 3.0, 4.0...} BuildVersion 10.0.17763.592 CLRVersion 4.0.30319.42000 WSManStackVersion 3.0 PSRemotingProtocolVersion 2.3 SerializationVersion 1.1.0.1

$PSModuleAutoloadingPreference is empty but according to Microsoft this means "all"

Pixelfool avatar Sep 01 '20 13:09 Pixelfool

I've got the same issue (as listed by duplicate). PoSH 5.1 does load modules dynamically.

Impot-Module is normally not a requirement as long as the module is stored in a folder listed by $env:PSModulePath

dennisl68-castra avatar Feb 15 '21 15:02 dennisl68-castra

I've got the same issue (as listed by duplicate). PoSH 5.1 does load modules dynamically.

Impot-Module is normally not a requirement as long as the module is stored in a folder listed by $env:PSModulePath

Is PSPKI module installed in a path referenced in $env:PSModulePath? Where exactly PSPKI is installed?

Crypt32 avatar Feb 15 '21 15:02 Crypt32

It's installed using Install-Module pspki -Scope CurrentUser

C:> get-module pspki -ListAvailable


    Directory: C:\Users\XXXXX\Documents\WindowsPowerShell\Modules


ModuleType Version    Name                                ExportedCommands
---------- -------    ----                                ----------------
Script     3.7.2      PSPKI                               {Add-AdCertificateRevocationList, Start-PsFCIV, Get-AdPkiConta...

dennisl68-castra avatar Feb 15 '21 15:02 dennisl68-castra

Unable to repro. Additional details needed. As a general recommendation, call Import-Module PSPKI explicitly before using it. Seems module autoload isn't reliable in all cases.

Crypt32 avatar Sep 18 '23 08:09 Crypt32