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

Binary Registry bug within PSDesiredStateConfiguration "Registry" Resource #70

Closed
athaynes opened this issue Aug 14, 2018 · 1 comment
Closed
Labels
bug Something isn't working
Milestone

Comments

@athaynes
Copy link
Contributor

From @JakeDean3631 on July 26, 2018 15:47

Describe the bug
Attempting to set a binary registry key to 0 will result in the key being set to "zero-length binary value" due to a bug with the registry resource parsing the value of 0 into a binary format.

To Reproduce
Steps to reproduce the behavior:

  1. Create a test configuration containing the following:

Configuration TestConfig {

 Import-DSCResource -ModuleName 'PSDesiredStateConfiguration'
 
 Nodename $Nodename 
 {
       Registry 'Registry(INF): HKLM:\System\CurrentControlSet\Control\Lsa\FullPrivilegeAuditing'
      {
       ValueName = 'FullPrivilegeAuditing'
       ValueType = 'Binary'
       Key = 'HKLM:\System\CurrentControlSet\Control\Lsa'
           ValueData = 0
           Ensure = "Present"
           Force = $True
        }
 }

}

  1. Generate a MOF and push the configuration.
  2. Check the HKLM:\System\CurrentControlSet\Control\Lsa registry key, it will be set to "Zero-Length Binary Value."
  3. Set the valuedata to 1, and it will parse correctly, resulting in the key being set to "01"
  4. Regardless of how you attempt to set the "00" value, it will result in the "Zero-Length Binary Value

Expected behavior
HKLM:\System\CurrentControlSet\Control\Lsa registry key should be set to "00"

Screenshots
image

image

Additional context
Work-around is importing the xPSDesiredStateConfiguration module and using the xRegistry resource, which will parse the value of "0" into a binary key of "00"

Example:

Configuration TestConfig {

 Import-DSCResource -ModuleName 'xPSDesiredStateConfiguration'
 
 Nodename $Nodename 
 {
       xRegistry 'Registry(INF): HKLM:\System\CurrentControlSet\Control\Lsa\FullPrivilegeAuditing'
      {
       ValueName = 'FullPrivilegeAuditing'
       ValueType = 'Binary'
       Key = 'HKLM:\System\CurrentControlSet\Control\Lsa'
           ValueData = 0
           Ensure = "Present"
           Force = $True
        }
 }

}

Link to the original bug: PowerShell/DscResources#203

Copied from original issue: microsoft/PowerStigDsc#14

@athaynes athaynes added the bug Something isn't working label Aug 14, 2018
@athaynes
Copy link
Contributor Author

@JakeDean3631 Do you want to take a stab at submitting the change so you get credit on the contributor's list?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant