microsoft / DSCParser

Allows the conversion of DSC scripts into PSObject for analysis purposes
MIT License
29 stars 19 forks source link

ConvertTo-DSCObject doesn't handle arrays with multiple cim instance PS objects well #19

Closed PrzemyslawKlys closed 2 years ago

PrzemyslawKlys commented 2 years ago

I've objects that look more or less like this:

    Node localhost
    {
        AADConditionalAccessPolicy 706192c4-1a75-465c-9592-479a9e90858e
        {
            ApplicationEnforcedRestrictionsIsEnabled = $False;
            #BuiltInControls                          = @("block");
            BuiltInControls                               = @(
                MSFT_SCLabelSetting
                {
                    Key   = 'contenttype'
                    Value = 'File  Email  Site  UnifiedGroup'
                }
                MSFT_SCLabelSetting
                {
                    Key   = 'tooltip'
                    Value = 'Disclosure of the information has substantial negative impact'
                }
            );
            ClientAppTypes                           = @("exchangeActiveSync","other");
            CloudAppSecurityIsEnabled                = $False;
            CloudAppSecurityType                     = "";
        }
     }

image

While you handle correctly strings, numbers, you overwrite the array if it's CIM instance with hashtable instead of adding it to array.