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. 




Comments

0 responses to “How to use psexec to remotely change DNS server?”

  1. vio rio Avatar
    vio rio

    Thanks bro!!