The absolute best way is top use a GPO.
If you have to do this with a script then reading the current paths from the registry and writing the new path to the registry would be the way to go.

I guess you already know but just in case you don’t. Be aware that a lot of changes to the registry are not instant and require a reboot.
_________________________
Mart

- Chuck Norris once sold ebay to ebay on ebay.