microsoft / DSCEA

DSC Environment Analyzer (DSCEA) is a simple implementation of PowerShell Desired State Configuration that uses the declarative nature of DSC to scan systems in an environment against a defined reference MOF file and generate compliance reports as to whether systems match the desired configuration.
https://microsoft.github.io/DSCEA
Other
197 stars 41 forks source link

Start-DSCEAscan -MofFile doesn't accept emtpy string from ValueName (GPO) #78

Open LosFla opened 2 years ago

LosFla commented 2 years ago

not able to use the attached .mof file to start DSCEA scan with the following cmlet:

PS C:\temp> Start-DSCEAscan -MofFile "C:\temp\Output\localhost.mof" -ComputerName localhost WARNING: PowerShell DSC resource MSFT_RegistryPolicyFile failed to execute Test-TargetResource functionality with error message: Cannot bind argument to parameter 'ValueName' because it is an empty string.

Test-TargetResource doesnt accept empty strings for 'ValueName' but my .mof file is correct.

localhost.mof.txt

can anyone help please?

rkyttle commented 2 years ago

It looks like you used DSCFromGPO to create the MOF? Looking at your MOF file, I do see a couple entries that do not have a value name. I think the issue is that the DSC Registry Resource cannot be used with a just a Key property, you have to use it with a Key and a Value, so even though you have a "valid" mof file, the DSC local configuration manager is not able to process it as it is missing data. You might be able to do that with the Set function, but the Test function appears like it requires that property.

Are you converting the GPO directly into the MOF? Is there an option to convert it into a DSC config first so you can easily make edits, then generate a MOF?