It definitely can do it, it is just a matter of figuring out what the correct commands are to make the changes needed.
The script you referenced seemed to be for setting DNS to OpenDNS specifically.
Which OSes are you trying to do this for? Windows 7 or later?
I haven’t really ever done this before, so I’d look for microsoft documentation on how to do this for the targeted OS. I’d also use relevance to dynamically target only the connections that actually exist on the target computer instead of the blunt force approach in the existing script.