Ah, well, you wouldn’t necessarily edit the CSV at all. You’re going to have to change your code, so that it can delete keys and change values. That’s not necessarily hard, but it’s non-trivial. For example, instead of using GetValue(), I imagine you’d use SetValue().
I’m not entirely certain what the CSV is even doing for you.
Hey Jeff,
Writing a script for this is making it harder on yourself than you need to. You can easily apply these settings using Group Policy. You can also use group policy with a WMI filter to change just the PDCe so that it syncs to an external source. That way all workstations sync to DCs, DCs sync to PDCe in their domain, PDCe syncs to Forest Root PDCe, Forest Root PDCe syncs to External source.