The other day, one of my scripts changed the DNS server on a desktop to an incorrect server. It killed that computer’s Internet access so I lost control through my RMM tool. However I was able to ping the computer from another computer on the network.
I know how to change DNS with PowerShell, but PowerShell remoting to the problem computer (using Enter-PSSession) didn’t work. Maybe a firewall issue.
Sysinternals to the rescue! PsExec got me a command prompt on the remote machine, and from there I was able to use netsh to update the computer’s DNS and get it back online:
netsh interface ip set dns "Local Area Connection" static 8.8.8.8
A big thanks to ingram’s 2011 (!) post here, which explains both PsExec and the necessary netsh commands: