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

DSC registry resource support '/' in the registry path. #285

Closed
zjalexander opened this issue Dec 1, 2016 · 9 comments
Closed

DSC registry resource support '/' in the registry path. #285

zjalexander opened this issue Dec 1, 2016 · 9 comments
Labels
bug The issue is a bug.

Comments

@zjalexander
Copy link

If you use a path containing a / e.g. "HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\SecurityProviders\SCHANNEL\Ciphers\RC2 40/128" then the builtin registry resource you end up with an error or the wrong registry path being created.

This config will not work. I've have to create my own module to create the folder and then us the registry resource to create the actual key.

Registry "DisableCipherRC240128" 
{ 
Key = "HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\SecurityProviders\SCHANNEL\Ciphers\RC2 40/128" 
ValueName = "Enabled" 
ValueType = "Dword" 
ValueData = "0" 
Ensure = "Present" 
Force = $true 
}

The register resource should support / in the path.

from uservoice: https://windowsserver.uservoice.com/forums/301869-powershell/suggestions/17239322-dsc-registry-resource-support-in-the-registry

@megamorf
Copy link
Contributor

megamorf commented Dec 1, 2016

Shouldn't the path be HKLM:\SYSTEM\... regardless of whether the forward slash isn't handled correctly?

Edit: nevermind, just checked the code

@chmadole
Copy link

chmadole commented Dec 3, 2016

I was able to repro this using the Registry resource, however it looks like the team has already fixed this in the xRegistry resource (note the leading x). I tested the exact code, swapping Registry for xRegistry and the keys created just fine. I used xPSDesiredStateConfiguration resource 5.0.0.0.

@bozho
Copy link
Contributor

bozho commented Jan 9, 2017

Hi,

This does not work for me in xPSDesiredStateConfiguration 5.1.0.0 on Win Server 2012R2. I get 128 as a separate subkey.

$PSVersionTable

Name                           Value
----                           -----
PSVersion                      5.0.10586.117
PSCompatibleVersions           {1.0, 2.0, 3.0, 4.0...}
BuildVersion                   10.0.10586.117
CLRVersion                     4.0.30319.42000
WSManStackVersion              3.0
PSRemotingProtocolVersion      2.3
SerializationVersion           1.1.0.1

Edit: To add to this, it looks like New-RegistryKey functions uses Split-Path to create necessary keys. Split-Path will split on forward slash.

bozho added a commit to bozho/xPSDesiredStateConfiguration that referenced this issue Jan 13, 2017
Replaced usages of Split-Path in New-RegistryKey with String.LastIndexOf
and String.Substring, splitting registry paths on backslash only.
bozho added a commit to bozho/xPSDesiredStateConfiguration that referenced this issue Jan 13, 2017
Replaced usages of Split-Path in New-RegistryKey with String.LastIndexOf
and String.Substring, splitting registry paths on backslash only.
@bozho
Copy link
Contributor

bozho commented Jan 13, 2017

Hi,

I've submitted a pull request for this issue: #306

@kwirkykat kwirkykat added bug The issue is a bug. in progress The issue is being actively worked on by someone. labels Jan 19, 2017
kwirkykat added a commit that referenced this issue Jan 25, 2017
[#285] DSC - xRegistry support for '/' in key names
@kwirkykat
Copy link
Contributor

Fixed by #306

@kwirkykat kwirkykat removed the in progress The issue is being actively worked on by someone. label Feb 1, 2017
@ewhitesides
Copy link

hi i was experiencing this issue and then arrived at this page from googling. has the fix been incorporated into the normal PSDesiredStateConfiguration resource yet?

@kwirkykat
Copy link
Contributor

@ewhitesides We are no longer working on the PSDesiredStateConfiguration module, so this fix is not in those resources. Most PSDesiredStateConfiguration resources have been replaced by the ones in the open-source PSDscResources module which can be installed from the PowerShell Gallery. If you don't have WMF 5.1 yet, this fix is also in the xPSDesiredStateConfiguration module from the PowerShell Gallery.

@NightOwl888
Copy link

@kwirkykat - In that case, why haven't the Visual Studio 2017 templates been updated to use one of the modules with the fix in it? Seems odd that the VS templates are adding a deprecated module by default.

image

image

@zjalexander
Copy link
Author

In that case, why haven't the Visual Studio 2017 templates been updated to use one of the modules with the fix in it? Seems odd that the VS templates are adding a deprecated module by default.

We don't own those templates, but I've found the owner and I'm working with them to get the VS templates updated. Thanks for pointing that out! :)

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

No branches or pull requests

7 participants