Information Technology Reference
In-Depth Information
4.
Verify that the radio button next to Use the Following IP Address is selected, and that
the IP address, subnet mask, and default gateway are configured.
5.
Click on Advanced and select the DNS tab. Use the Add button to add a server to the
DNS search order. To remove a server from the list, select the IP address of the server
and click on Remove. To change the order of the DNS servers that are listed, select the IP
address of a server and click on the Up or Down arrows—DNS servers are queried from
top to bottom in the order that they are listed. You can also use the Edit button to modify
the IP address of an existing DNS server.
6.
Click OK when you're finished.
Using a Command-Line Interface
The following example adds a new DNS server, 10.0.0.100 , as the second server in the DNS
search order for the Local Area Connection interface:
> netsh interface ip add dns "Local Area Connection" 10.0.0.100 index=2
Using the Registry
To configure the DNS servers for a network interface card, configure the following Registry
value. Add the IP addresses of the DNS servers in the order that they should appear in the
search list:
[HKey_Local_Machine\System\CurrentControlSet\Services\Tcpip\Parameters\]
"NameServer" = REG_SZ:" <IP Address1> " " <IP Address2> " " <IP Address3> "
Using VBScript
This code example will add a DNS server with the IP address of 192.168.1.151 to the beginning
of the DNS search order.
' ------ SCRIPT CONFIGURATION ------
strComputer = "."
strNewDNSServer = "192.168.1.151"
' --------- END CONFIGURATION ------
Set objWMIService = GetObject("winmgmts:" _
& "{impersonationLevel=impersonate}!\\" & strComputer & "\root\cimv2")
Set nics = objWMIService.ExecQuery _
("SELECT * FROM Win32_NetworkAdapterConfiguration WHERE IPEnabled = True")
For Each nic In nics
' grab the current DNS search order
arrDNSServerOrder = nic.DNSServerSearchOrder
' create a new array to hold the current DNS servers, plus one new one
intNewArraySize = UBound(arrDNSServerOrder) + 1
ReDim Preserve arrDNSServerOrder(intNewArraySize)
Search WWH ::




Custom Search