Closed General-Fault closed 6 months ago
@erjenkin and I are able to reproduce this issue. We'll have a fix PR submitted this afternoon with additional detail/findings.
Has this been fixed in 1.3.1?
To answer my own question - confirmed fixed in 1.3.1. Thank you!
Thanks for confirming that. I close this issue then.
Details of the scenario you tried and the problem that is occurring
When setting a registry policy file value that is a MultiString with multiple entries, all items end up in the same entry separated by spaces.
For example, when setting the group policy "ComputerConfiguration\Administrative Templates\Network\SSL ConfigurationSettings\ECC Curve Order" (registry key "HKLM:\SOFTWARE\Policies\Microsoft\Cryptography\Configuration\SSL\00010002:EccCurves" to @('curve25519', 'NistP384', NistP256'), the three values are saved in one string as 'curve25519 NistP384 NistP256'.
The fault can be found in New-GPRegistrySettingsEntry (https://github.com/dsccommunity/GPRegistryPolicyDsc/blob/3f0c2341eb03219637f0832562465008c80b0d0d/source/Modules/GPRegistryPolicyFileParser/GPRegistryPolicyFileParser.psm1#L310) where the ValueData array is implicitly cast to a string before being passed to Unicode.GetBytes. The array string separates the values with a space, not a null character as is needed.
Verbose logs showing the problem
N/A
Suggested solution to the issue
New-GPRegistrySettingsEntry should join the values with a null character before passing to Unicode.GetBytes
as in
Similarly Format-MultiStringValue should not split on a space.
The DSC configuration that is used to reproduce the issue (as detailed as possible)
This can be reproduced using Invoke-DscResource
The operating system the target node is running
Version and build of PowerShell the target node is running
Version of the DSC module that was used