Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How do I escape backslashes in keyValuename when using cAdministrativeTemplateSetting DSC resource? #21

Open
techsnav opened this issue Dec 24, 2020 · 2 comments

Comments

@techsnav
Copy link

techsnav commented Dec 24, 2020

Hi Dave, I'm running into an issue when using PolicyFileEditor with DSC:

For eg, the script below works fine, sets the Group Policy as expected:
$UserDir = "$env:windir\system32\GroupPolicy\Machine\Registry.pol"
$RegPath = 'Software\Policies\Microsoft\Windows\NetworkProvider\HardenedPaths'
$RegName = '\*\NETLOGON' # Backslash Backslash Asterisk Backslash NETLOGON
$RegData = 'RequireMutualAuthentication=1, RequireIntegrity=1, RequirePrivacy=1'
$RegType = 'String'
Set-PolicyFileEntry -Path $UserDir -Key $RegPath -ValueName $RegName -Data $RegData -Type $RegType
gpupdate

But not sure how to include "\*\NETLOGON" as ValueName for Key 'Software\Policies\Microsoft\Windows\NetworkProvider\HardenedPaths' when using in DSC? I've tried it in few different ways, but couldn't get it working.

cAdministrativeTemplateSetting 'Hardened UNC Paths NETLOGON'
{
KeyValueName = "Software\Policies\Microsoft\Windows\NetworkProvider\HardenedPaths$([char]0x005C)$([char]0x005C)*$([char]0x005C)NETLOGON"
PolicyType = 'Machine'
Data = 'RequireMutualAuthentication=1, RequireIntegrity=1, RequirePrivacy=1'
Ensure = 'Present'
Type = 'String'
}

Appreciate your help!!!

@techsnav techsnav changed the title How do I escape backslashes in keyname when using cAdministrativeTemplateSetting DSC resource? How do I escape backslashes in keyValuename when using cAdministrativeTemplateSetting DSC resource? Dec 24, 2020
@techsnav
Copy link
Author

HardenedUNCPath

@techsnav
Copy link
Author

Apologies, if I wasn't clear, but this setting is under Administrative Templates:

Computer Configuration\Policies\Administrative Templates\Network\Network Provider\Hardened UNC Paths

Thanks.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant