-
Notifications
You must be signed in to change notification settings - Fork 6
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
Merge-Array doesn't appear to be merging #31
Comments
Hi @martincaddick, a few important comments:
My1stResource = @(
@{
UniqueID = "MyObject1"
Parameter1 = 'Test'
Parameter2 = $false
THE REST OF YOUR SETTINGS
}
@{
UniqueID = "MyObject2"
Parameter1 = 'Demo'
Parameter2 = $true
THE REST OF YOUR SETTINGS
}
)
$My2ndResource = @(
@{
UniqueID = "MyObject2"
Parameter1 = 'DemoEdit'
Parameter2 = $false
THE REST OF YOUR SETTINGS
}
) When merging these two, just the 2nd object in the first array is updated with the values in the 2nd array, since those UniqueID parameter values are matching.
Settings = @{
ALL OF YOUR SETTINGS
} instead of Settings = @(
@{
ALL OF YOUR SETTINGS
}
) |
@ykuijs Makes perfect sense and when I remove the hashtable it works as intended. Very nice. Then I tried to work out why I had a hashtable inside the array. I started with this and found I needed to change 'Configuration .\OD' to 'Configuration OD' in order to make Convert-M365DSCExportToPowerShellDataFile work. Then it produced the psd1 which I didn't even check before trying it. For some reason the Convert put it in a hashtable. Side note, I also need to change the '.\OD' at the bottom of the script in order to get it to create the mof files.
|
Good to hear! The Convert-M365DSCExportToPowerShellDataFile function is a very rough first draft of this function that has some issues. We are currently working on an update of that function to make it much more usable and reliable, testing all values and comparing them against the schema. That way we will make sure the generated data files is correct. However, there is no ETA known yet......aiming for as soon as possible 😉 |
Merge-Array works as advertised. New issue #32 created for the export of ODSettings. |
Awesome work Yorick.
Am I doing something wrong or is this the expected result?
And this was the end result.
The text was updated successfully, but these errors were encountered: