Modify the DNS Server Search Order for a Network Adapter 
' Modify the DNS Server Search Order for a Network Adapter
On Error Resume Next
strComputer = "."
Set objWMIService = GetObject("winmgmts:" _
    & "{impersonationLevel=impersonate}!\\" & strComputer & "\root\cimv2")
Set colNetCards = objWMIService.ExecQuery _
    ("Select * From Win32_NetworkAdapterConfiguration Where IPEnabled = True")
For Each objNetCard in colNetCards
    arrDNSServers = Array("192.168.1.100", "192.168.1.200")
    objNetCard.SetDNSServerSearchOrder(arrDNSServers)
Next
VbsEdit contains all these sample scripts!
 
Download  
Home  
Scripts
 
Copyright © 2001-2025 adersοft