GPRegistryPolicyDsc
GPRegistryPolicyDsc copied to clipboard
RegistryPolicyFile: Conflicting Key When Setting Same Policy For Multiple Target Types
Details of the scenario you tried and the problem that is occurring
I am trying to set the same user configuration policy for all users of the PC however there is no target type for "All Users" and because the target type is not a Key parameter there can't be multiple instances of the resource with the same parameters named "Key" and "ValueName".
Verbose logs showing the problem
This is the error message:
PSDesiredStateConfiguration\Configuration : A conflict was detected between resources '[RegistryPolicyFile]SetDesktopWallpaperPathForAdmin (C:\Agent-1\_work\4\s\Package Builders\Win10BaseConfig\Config.ps1::164::7::RegistryPolicyFile)' and '[RegistryPolicyFile]SetDesktopWallpaperPath (C:\Agent-1\_work\4\s\Package Builders\Win10BaseConfig\Config.ps1::182::7::RegistryPolicyFile)' in node 'localhost'. Resources have identical key properties but there are differences in the following non-key properties: 'TargetType'. Values 'Administrators' don't match values 'NonAdministrators'. Please update these property values so that they are identical in both cases.
Suggested solution to the issue
Either add a target type that can add a policy for all users Update Target Type to be one of the Key parameters Update the Account Name Parameter to take an array of users and groups.
The DSC configuration that is used to reproduce the issue (as detailed as possible)
RegistryPolicyFile SetDesktopWallpaperStyle
{
Key = "Software\Microsoft\Windows\CurrentVersion\Policies\System"
TargetType = 'Administrators'
ValueName = "WallpaperStyle"
ValueType = 'Dword'
ValueData = "0"
}
RegistryPolicyFile SetDesktopWallpaperStyle
{
Key = "Software\Microsoft\Windows\CurrentVersion\Policies\System"
TargetType = 'NonAdministrators'
ValueName = "WallpaperStyle"
ValueType = 'Dword'
ValueData = "0"
}
The operating system the target node is running
OsName : Microsoft Windows 10 Enterprise LTSC
OsOperatingSystemSKU : 125
OsArchitecture : 64-bit
WindowsVersion : 1809
WindowsBuildLabEx : 17763.1.amd64fre.rs5_release.180914-1434
OsLanguage : en-GB
OsMuiLanguages : {en-GB}
Version and build of PowerShell the target node is running
Name Value
---- -----
PSVersion 5.1.17763.1432
PSEdition Desktop
PSCompatibleVersions {1.0, 2.0, 3.0, 4.0...}
BuildVersion 10.0.17763.1432
CLRVersion 4.0.30319.42000
WSManStackVersion 3.0
PSRemotingProtocolVersion 2.3
SerializationVersion 1.1.0.1
Version of the DSC module that was used
Name Version Path
---- ------- ----
GPRegistryPolicyDsc 1.2.0 C:\Program Files\WindowsPowerShell\Modules\GPRegistryPolicyDsc\1.2.0\GPRegistryPolicyDsc.psd1