How to use psexec to remotely change DNS server?

This tutorial will guide you through the commands to change DNS remotely.

I already assume that you know Psexec and you have basic Windows networking knowledge 😉

OK. so let’s begin!

Let’s check interface names on remote machine:

psexec64 -s /user:domain\user -i \\COMPUTER_NAME cmd /c netsh interface show interface

You should get:

In polish Windows it’s Połączenie lokalne

Now you can change primary or secondary DNS like that:

psexec64 -s /user:domain\user -i \\COMPUTER_NAME cmd /c netsh interface ipv4 set dnsservers "Połączenie lokalne" static 8.8.8.8 primary

And that’s it. Done. 

Published by

Konrad Fedorczyk

I'm interested in programming and gamedev. I especially luv HTML5 and everything connected to web technologies.

Leave a Reply

Your email address will not be published.