ParseExact Exception

Aug 16, 2013 at 2:42 PM
Hi, I'm receiving an exception during the revocation of a certificate. It is successfully revoking, I'm just getting the following error in my ErrorDump log. Has anyone else encountered this error? I'm using PSPKI v 2.0.0 Thanks.

Exception calling "ParseExact" with "3" argument(s): "String was not recognized as a valid DateTime."
At C:\WINDOWS\system32\WindowsPowerShell\v1.0\Modules\PSPKI\Get-RequestRow.ps1:37 char:36
  • $dt = [DateTime]::ParseExact <<<< ($Value,"MM/dd/yyyy HH:mm:ss",[Globalization.CultureInf
    • CategoryInfo : NotSpecified: (:) [], MethodInvocationException
    • FullyQualifiedErrorId : DotNetMethodException
Aug 16, 2013 at 3:10 PM
Can you provide exact command you are calling?
Aug 21, 2013 at 10:35 PM
I'm receiving it after running the following command...

$certLookup = Get-CertificationAuthority | Get-IssuedRequest -filter "CommonName -eq $cert"

$cert would be a FQDN such as
$certLookup would contain entries such as...

RequestID : 23409
Request.RequesterName : Domain\Requestor1
CommonName :
NotBefore : 7/29/2013 5:42:04 PM
NotAfter : 7/29/2014 5:42:04 PM
SerialNumber : 51bf92eb000012305b71
ConfigString :\Contoso Root CA

RequestID : 24839
Request.RequesterName : Domain\Requestor2
CommonName :
NotBefore : 8/13/2013 4:29:43 PM
NotAfter : 8/13/2015 4:29:43 PM
SerialNumber : 8dbca20d00012306107
ConfigString :\Contoso Root CA
Aug 22, 2013 at 5:37 AM
What do you mean under "ErrorDump log"? I just checked the code and you should not receive any errors in the console. Although, errors are handled by $error variable, it is expected behavior. The code internally tries to cast qualifier value to various formats (Integer, DateTime, OID, String). But casting failures are handled internally and no exception message is returned to the console.
Aug 22, 2013 at 2:05 PM
I have written a number of scripts to perform various administrative functions for my team members. One of them is to handle certificate revocation, all they need to provide is the FQDN and the script takes care of querying the CA and displaying it back to the user. The user does not need to have any scripting experience to run it. As part of this, I perform a dump of the $error variable at the end of the script execution to a central log file for troubleshooting unexpected behavior. The O.P. error message is appearing in the error dump of my script and I wasn't sure if I was doing something wrong or if I stumbled onto a bug. Seeing as how I had not any terminating errors and the PSPKI module functions seemed to the working, I posted the error to see if this was expected behavior or something else.

Thank you for the clarification.