ESXCLI - Update Host DNS
Need to update DNS servers on a bunch of hosts?
If you ever find yourself in a position where you need to update DNS on a bunch of hosts, this might get the job done.
It's fairly straight forward. First get the vCenter and do no validation, connect to said vCenter, get a list of all hosts, then strip all DNS servers and add the ones desired back in.
What makes this ugly?
There's no input validation
There's no function to make this more portable
It doesn't care what DNS is there, it just obliterates it.
New DNS values are hardcoded.