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

Can not run Get-DSCConfiguration when using xRegistry module #304

Closed
TheRealBenForce opened this issue Jan 11, 2017 · 4 comments · Fixed by #330
Closed

Can not run Get-DSCConfiguration when using xRegistry module #304

TheRealBenForce opened this issue Jan 11, 2017 · 4 comments · Fixed by #330
Assignees
Labels
bug The issue is a bug. in progress The issue is being actively worked on by someone.

Comments

@TheRealBenForce
Copy link

TheRealBenForce commented Jan 11, 2017

I'm using xRegistry 5.1.0.0 to allow binary data 00 due to issue #276. This is the only experimental module I'm using in my configurations, however I have many others from the PSDesiredStateConfiguration 1.1.

Get-DSCConfiguration fails with the following output in powershell:

Get-DscConfiguration : GetConfiguration did not succeed.
At line:1 char:1
+ Get-DscConfiguration
+ ~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : NotSpecified: (MSFT_DSCLocalConfigurationManager:root/Microsoft/...gurationManager) [Get 
   -DscConfiguration], CimException
    + FullyQualifiedErrorId : MI RESULT 1,Get-DscConfiguration

Event Log results after running Get-DSCConfiguration:

Log Name:      Microsoft-Windows-DSC/Operational
Source:        Microsoft-Windows-DSC
Date:          1/11/2017 9:53:37 AM
Event ID:      4250
Task Category: None
Level:         Error
Keywords:      
User:          SYSTEM
Computer:      DSCPullClient
Description:
Job {BA6A8FA8-D80D-11E6-8162-0A8B1BA44ED0} : 
Message Unable to cast object of type 'System.String' to type 'System.Collections.IList'.
Parameter name: value 
HResult -2147024809 
StackTrack    at Microsoft.Management.Infrastructure.Internal.Data.CimPropertyOfInstance.set_Value(Object value)
   at Microsoft.PowerShell.DesiredStateConfiguration.Internal.ResourceProviderAdapter.GetTargetResource(IntPtr resourceConfigurationInstanceHandle, IntPtr nonResourcePropetiesHandle, IntPtr metaConfigHandle, IntPtr regInstanceHandle, IStreamsHandler plugInStreamsHandler, IntPtr& outputInstanceHandle, IntPtr& errorInstanceHandle)
   at Microsoft.PowerShell.DesiredStateConfiguration.Internal.DscPluginManagedEntryWrapper.Get(IntPtr provContext, IntPtr instance, IntPtr nonResourcePropeties, IntPtr metaConfig, IntPtr regInstance, IntPtr outputInstance, IntPtr extendedError)
Log Name:      Microsoft-Windows-DSC/Operational
Source:        Microsoft-Windows-DSC
Date:          1/11/2017 9:53:37 AM
Event ID:      4252
Task Category: None
Level:         Error
Keywords:      
User:          SYSTEM
Computer:      DSCPullClient
Description:
Job {BA6A8FA8-D80D-11E6-8162-0A8B1BA44ED0} : 
MIResult: 1
Error Message: GetConfiguration did not succeed.
Message ID: MI RESULT 1
Error Category: 0
Error Code: 1
Error Type: MI
Log Name:      Microsoft-Windows-DSC/Operational
Source:        Microsoft-Windows-DSC
Date:          1/11/2017 9:53:37 AM
Event ID:      4097
Task Category: Send configuration scenario for Local configuration manager
Level:         Error
Keywords:      
User:          SYSTEM
Computer:      DSCPullClient
Description:
Job {BA6A8FA8-D80D-11E6-8162-0A8B1BA44ED0} : 
This event indicates that failure happens when LCM is processing the configuration. Error Id is 0x1. Error Detail is The SendConfigurationApply function did not succeed.. Resource Id is [xRegistry]AuditBackupRightsEnabled and Source Info is ::45::9::xRegistry. Error Message is NULL.

The referenced instance from the job ID mof file is this:

instance of MSFT_ResourceInDesiredState as $Alias00000041
{
    ResourceId = "[xRegistry]RemovedForSecurity";
    SourceInfo = "::45::9::xRegistry";
    ModuleName = "xPSDesiredStateConfiguration";
    ModuleVersion = "5.1.0.0";
    ConfigurationName = "PartialConfig";
    ResourceName = "xRegistry";
    InstanceName = "RemovedForSecurity";
    InDesiredState = True;
    StartDate = "20170111095336.756000-300";
    DurationInSeconds = 0.0000000000000000000000000000000000000000000000000000E+000;
    RebootRequested = False;
};

My resource configuration:

xRegistry AuditBackupRightsEnabled
{
    Key         = 'HKLM:\SYSTEM\CurrentControlSet\Control\Lsa'
    ValueName   = 'FullPrivilegeAuditing'
    ValueData   = 00 # Have also tried passing this as a string.
    ValueType   = 'Binary'            
    Ensure      = 'Present'
    Force       = $true
}

This is the only instance of an experimental resource I'm using in my partial configuration. As a tested, I attempted to use xUser and xService while commenting out my xRegistry. I was able to Get-DSCConfiguration fine and also confirmed my new config was pulled. When I switched back to User, Service and uncommenting xRegistry, the problem resurfaced on my first attempt to Get-DSCConfiguration.

@TheRealBenForce
Copy link
Author

TheRealBenForce commented Jan 11, 2017

I previously had some commentary in my initial post about how I thought this may be causing additional problems with applying configurations where they seem to hang. I've removed those comments since I can not solidly reproduce the issue 100%, however I will continue to investigate. I am able to reproduce the error on Get-Configuration when using xRegistry 100%.

UPDATE: The slowness when applying configurations seems to be related to this:
Some DSC resources like registry resource may start to take a long time to process the request.
I implemented the suggested fix and that works like a charm.

The initial posting is still an outstanding issue. I've updated the initial post to include the resource configuration which I see now I forgot to include.

@TheRealBenForce
Copy link
Author

I've recreated this in a second lab environment with out all stack software installed in my enterprise environment. I used the Microsoft Windows 2012 R2 AMIs on EC2. @kwirkykat Has anybody from DSC team looked at this yet to validate if it is a bug? I'm new to the community and still learning DSC. Seems like xRegistry is slated to become HQRM next week. If Get-DSCConfiguration is not functioning when setting binary registry keys with xRegistry, that seems like a pretty large bug for a HQRM.

@kwirkykat
Copy link
Contributor

@TheRealBenForce I'm looking at it

@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 kwirkykat self-assigned this Jan 19, 2017
@TheRealBenForce
Copy link
Author

Awesome, you rock @kwirkykat!

kwirkykat added a commit that referenced this issue Mar 7, 2017
xRegistry: Fix Get-DSCConfiguration (Fixes #304)
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. in progress The issue is being actively worked on by someone.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants