PSPKI
PSPKI copied to clipboard
PSPKI v4.2.0 Module cannot find type [PKI.OCSP.OCSPRequest]
When running Get-EnterprisePKIHealthStatus with version 4.2.0 on PowerShell 5.1, it gives out this error.
DEBUG: Entering OCSP validation routine...
DEBUG: URL: http://ocsp.******.***/ocsp
New-Object : Cannot find type [PKI.OCSP.OCSPRequest]: verify that the assembly containing this type is loaded.
At C:\Program Files\WindowsPowerShell\Modules\PSPKI\4.2.0\Server\Get-EnterprisePKIHealthStatus.ps1:451 char:20
+ $req = New-Object PKI.OCSP.OCSPRequest $cert.Certificate
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : InvalidType: (:) [New-Object], PSArgumentException
+ FullyQualifiedErrorId : TypeNotFound,Microsoft.PowerShell.Commands.NewObjectCommand
The property 'URL' cannot be found on this object. Verify that the property exists and can be set.
At C:\Program Files\WindowsPowerShell\Modules\PSPKI\4.2.0\Server\Get-EnterprisePKIHealthStatus.ps1:452 char:13
+ $req.URL = $urlElement.Url
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : InvalidOperation: (:) [], RuntimeException
+ FullyQualifiedErrorId : PropertyNotFound
This error does not happen with v3.4.x on Powershell 5.1. I thought it was due to an error while upgrading so have installed the module on another computer which never had PSPKI before and give out the same error.
For reference
$PSVersionTable
Name Value
---- -----
PSVersion 5.1.19041.4412
PSEdition Desktop
PSCompatibleVersions {1.0, 2.0, 3.0, 4.0...}
BuildVersion 10.0.19041.4412
CLRVersion 4.0.30319.42000
WSManStackVersion 3.0
PSRemotingProtocolVersion 2.3
SerializationVersion 1.1.0.1
Thanks for reporting! The fix is added and will be available in v4.3. For now, you can manually change Get-EnterprisePKIHealthStatus as in this commit: https://github.com/PKISolutions/PSPKI/commit/475e2ab6794bbbe52762f9baf8f1d32bc35c80c5