Closed Borgquite closed 9 months ago
I agree that's an inexcusable behavior: the challenge here is that the module convert everything from XML into PowerShell objects. So just to keep filters as they are the module needs to have classes for all of them.
Another quick and dirty option would be to keep the Filters section as a string, without parsing it. I think I should implement this first and then code proper parsing in a separate branch.
Thank you @Borgquite !!
Fixed in #46
Hi,
Sorry to raise another one - I think I hinted at this earlier in #32 but never got around to posting it!
I have encounted a number of occasions where adding a new entry to a GPO that has already been configured via the GUI results in data loss. Here is one example:
Say I have a more complex GP Preferences setup from the GUI (using environment variables and WMI filters) within a GPO. I'll attach an example below. I can 'get' basic information from it using Get-GPPGroup although that information does not include the WMI filters etc which is fair enough.
Get-GPPGroup -GPOName "TEST GPO"
However when I try to add a new entry (without touching the existing ones in any way!) using New-GPPGroupMember and New-GPPGroup:
PSGPPreferences adds the new entry, but also changes the entirety of the existing XML and messes up a load of things:
Is it not possible to have GPPreferences perform changes in a more 'light touch' way? Instead of reading the data, trying to process every attribute, then output it again (which would involve correctly implementing the entire specification, which I'm not sure is public knowledge), wouldn't it be better to read the XML in and only edit the parts that the command actually related to, and writing out the rest exactly as it was before? At present running GPPreferences against an existing GPO that is at all complex is nerve wracking, since you never know what might be accidentally lost.
Here's a slightly more complicated Groups.xml generated by the GP Preferences GUI to see how attributes (like bypassErrors, userContext, sid and the WMI filters) are added/removed/generally altered:
Original Groups.xml (GUI only):