How To Change DNS Server Settings Remotely

Spread the news
  •  
  •  
  •  
  •  
  •  
  •  
  •  
  •  
  •  
    48
    Shares

Overview

This article will walk you through changing the DNS server using NetSH on remote computers with the remote scripting features in Bozteck VENM Remote Desktop Manager.

Bozteck VENM (VNCScan Enterprise Network Manager) lets you extend its numerous built in remote management capabilities by creating your own scripts that you can push and execute on the computers across your LAN and VPN connections.

Click here to watch a video of these steps in action!

Step 1 – Open the Script Editor

With VENM open to the main window shown below, we will create the scrip by clicking on the link in the right side bar titled “Edit Remote Scripts”.  You will find it in the “Deployment Tasks” section.

Remote Scripting by Bozteck VENM

Step 2 – Create a new script

In the window that opens (shown below), click the black plus sign in the upper right to create a new script.

Remote Scripting by Bozteck VENM

Step 3 – Author the script

From the scripting engine drop-down, choose Windows CMD.  The default is PowerShell but since we are using a windows command script to perform this action, we will need to choose the correct command processor.

You can paste in a script or author it right there in the editor.  In this case, you can paste the script below:

@ECHO OFF
SETLOCAL EnableDelayedExpansion

SET adapterName=

FOR /F “tokens=* delims=:” %%a IN (‘IPCONFIG ^| FIND /I “ETHERNET ADAPTER”‘) DO (
SET adapterName=%%a

REM Removes “Ethernet adapter” from the front of the adapter name
SET adapterName=!adapterName:~17!

REM Removes the colon from the end of the adapter name
SET adapterName=!adapterName:~0,-1!

netsh interface ipv4 set dns name=”!adapterName!” static 192.168.3.3 primary
netsh interface ipv4 add dns name=”!adapterName!” 192.168.3.7 index=2
)

ipconfig /flushdns

:EOF
Pause

The window should look like the one shown below.

Remotely Change DNS for network adapters

Step 4 – Deploy the script to a remote computer

After you have saved your new script, head back to the main Bozteck VENM window and select one or more computers.  With those selected, chose your new script from the dropdown in the right tool area shown in the screen shot below.  With those two things selected, press the “Execute” button and watch VENM work it’s magic.

Deploy scripts remotely with Bozteck VENM