I would suggest looking at:
dpcmd set-duplication-recursive
(type that at an administrative command prompt for usage information and examples)
It accepts simple patterns and regular expressions as well.
You can also use this from a batch / program:
dpcmd set-duplication