On my server configured with German language settings I get errors like:
Line |
1031 | $expiration = [datetime]::ParseExact($Certificate.apiRawV …
| ~~~~~~~~~~~~~
| Exception calling "ParseExact" with "3" argument(s): "String 'Dec 20 08:36:03 2022' was not recognized
| as a valid DateTime."
Parse Exact fails because in German it would be "Dez" for December.
This worked for me:
$expiration = [datetime]::ParseExact($Certificate.apiRawValues.expiration.Replace(' GMT','').Replace(" "," "),"MMM d H:mm:ss yyyy", [CultureInfo]::InvariantCulture)
On my server configured with German language settings I get errors like: Line | 1031 | $expiration = [datetime]::ParseExact($Certificate.apiRawV … |
~~~~~~~~~~~~~ | Exception calling "ParseExact" with "3" argument(s): "String 'Dec 20 08:36:03 2022' was not recognized | as a valid DateTime."Parse Exact fails because in German it would be "Dez" for December.
This worked for me: $expiration = [datetime]::ParseExact($Certificate.apiRawValues.expiration.Replace(' GMT','').Replace(" "," "),"MMM d H:mm:ss yyyy", [CultureInfo]::InvariantCulture)