Is it possible to install the PKI module on Powershell Core? Is it possible to install the PKI module on Powershell Core? powershell powershell

Is it possible to install the PKI module on Powershell Core?


The PKI module can be imported using

Import-Module -Name C:\Windows\System32\WindowsPowerShell\v1.0\Modules\PKI\pki.psd1

on PowerShell v6.0.4

or

Import-Module -Name C:\Windows\System32\WindowsPowerShell\v1.0\Modules\PKI\pki.psd1 -SkipEditionCheck

on PowerShell v6.1 release candidate 1

BUT the two cmdlets I tested both failed to run

PS>  Get-CertificateGet-Certificate : The type initializer for '<Module>' threw an exception.At line:1 char:1+ Get-Certificate+ ~~~~~~~~~~~~~~~+ CategoryInfo          : NotSpecified: (:) [], TypeInitializationException+ FullyQualifiedErrorId : System.TypeInitializationExceptionPS>  Test-Certificate -Cert  Cert:\LocalMachine\My\494D1D7AFE42DD86D3968814CD4530AF29288BE1 -AllowUntrustedRootTest-Certificate : The type initializer for '<Module>' threw an exception.At line:1 char:1+ Test-Certificate -Cert  Cert:\LocalMachine\My\494D1D7AFE42DD86D396881 ...+ ~~~~~~~~~~~~~~~~+ CategoryInfo          : NotSpecified: (:) [], TypeInitializationException+ FullyQualifiedErrorId : System.TypeInitializationException

Which means that you're not going to be able to use the cmdlets directly in PowerShell v6.x at the moment.

What you could do is create a PowerShell remoting session (WinRM) to the local machine then import the PKI module into that session. That would give you proxy functions for the cmdlets that you could use from PowerShell v6. You'd have to repeat the import if you wanted to use the PKI module in another PowerShell v6 session