From fcc8b5dd93a7f073f0e2cc80cf8b0fd9280d665d Mon Sep 17 00:00:00 2001 From: Chris Hill <53898223+Borgquite@users.noreply.github.com> Date: Mon, 12 Feb 2024 16:35:52 +0000 Subject: [PATCH] ADSRootKey: Resolved 'String was not recognized as a valid DateTime' in non-US cultures (#703) - ADSRootKey - Resolved 'String was not recognized as a valid DateTime' in non-US cultures (issue #702). --- CHANGELOG.md | 2 ++ source/DSCResources/MSFT_ADKDSKey/MSFT_ADKDSKey.psm1 | 2 +- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index e0b3a490..fb27e28d 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -12,6 +12,8 @@ For older change log history see the [historic changelog](HISTORIC_CHANGELOG.md) - Move test pipeline to Windows PowerShell. The hosted agent was updated to PowerShell 7.4.1. That broke the ASKDSKey unit tests that has a helper function (`Copy-ArrayObjects`) that serializes objects. +- ADSRootKey + - Resolved 'String was not recognized as a valid DateTime' in non-US cultures ([issue #702](https://github.com/dsccommunity/ActiveDirectoryDsc/issues/702)). ## [6.3.0] - 2023-08-24 diff --git a/source/DSCResources/MSFT_ADKDSKey/MSFT_ADKDSKey.psm1 b/source/DSCResources/MSFT_ADKDSKey/MSFT_ADKDSKey.psm1 index 1760751e..ae45ac01 100644 --- a/source/DSCResources/MSFT_ADKDSKey/MSFT_ADKDSKey.psm1 +++ b/source/DSCResources/MSFT_ADKDSKey/MSFT_ADKDSKey.psm1 @@ -107,7 +107,7 @@ function Get-TargetResource elseif ($kdsRootKey) { $targetResource['Ensure'] = 'Present' - $targetResource['EffectiveTime'] = ([DateTime]::Parse($kdsRootKey.EffectiveTime)).ToString() + $targetResource['EffectiveTime'] = $kdsRootKey.EffectiveTime.ToString('o') $targetResource['CreationTime'] = $kdsRootKey.CreationTime $targetResource['KeyId'] = $kdsRootKey.KeyId $targetResource['DistinguishedName'] = 'CN={0},CN=Master Root Keys,CN=Group Key Distribution Service,CN=Services,CN=Configuration,{1}' -f