When I run Get-Ca | Get-EnterprisePKIHealthStatus -Debug -Verbose I receive the attached error. I'm running this command from an elevated PowerShell session on Windows 8.1 Enterprise. My PKI consists of an offline root ca and an enterprise sub-ca
Comments: I've been digging into the Get-EnterprisePKIHealthStatus.ps1 and I believe I have found the reason as to why I'm getting the NetworkRetievalError error message. The following line: ``` if ($OcspCertExpirationThreshold -le $elapsed / $totalValidity * 100) { ``` throws the following error message: ``` Method invocation failed because [System.TimeSpan] does not contain a method named 'op_Division'. At C:\Program Files\Sysadmins LV\PowerShell\Modules\pspki\Server\Get-EnterprisePKIHealthStatus.ps1:464 char:10 + if ($OcspCertExpirationThreshold -le $elapsed / $totalValidity * 100) { + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + CategoryInfo : InvalidOperation: (op_Division:String) [], RuntimeException + FullyQualifiedErrorId : MethodNotFound Argument types do not match At C:\Program Files\Sysadmins LV\PowerShell\Modules\pspki\Server\Get-EnterprisePKIHealthStatus.ps1:474 char:5 + $urlElement.SetError($errorCode) + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + CategoryInfo : OperationStopped: (:) [], ArgumentException + FullyQualifiedErrorId : System.ArgumentException ``` If I change ``` if ($OcspCertExpirationThreshold -le $elapsed / $totalValidity * 100) { ``` to ``` if ($OcspCertExpirationThreshold -le $elapsed.TotalSeconds / $totalValidity * 100) { ``` The OCSP check returns success.
Comments: I've been digging into the Get-EnterprisePKIHealthStatus.ps1 and I believe I have found the reason as to why I'm getting the NetworkRetievalError error message. The following line: ``` if ($OcspCertExpirationThreshold -le $elapsed / $totalValidity * 100) { ``` throws the following error message: ``` Method invocation failed because [System.TimeSpan] does not contain a method named 'op_Division'. At C:\Program Files\Sysadmins LV\PowerShell\Modules\pspki\Server\Get-EnterprisePKIHealthStatus.ps1:464 char:10 + if ($OcspCertExpirationThreshold -le $elapsed / $totalValidity * 100) { + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + CategoryInfo : InvalidOperation: (op_Division:String) [], RuntimeException + FullyQualifiedErrorId : MethodNotFound Argument types do not match At C:\Program Files\Sysadmins LV\PowerShell\Modules\pspki\Server\Get-EnterprisePKIHealthStatus.ps1:474 char:5 + $urlElement.SetError($errorCode) + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + CategoryInfo : OperationStopped: (:) [], ArgumentException + FullyQualifiedErrorId : System.ArgumentException ``` If I change ``` if ($OcspCertExpirationThreshold -le $elapsed / $totalValidity * 100) { ``` to ``` if ($OcspCertExpirationThreshold -le $elapsed.TotalSeconds / $totalValidity * 100) { ``` The OCSP check returns success.