Need help setting DNS settings via VBS.

Home Forums Scripting General Scripting Need help setting DNS settings via VBS.

Viewing 1 post (of 1 total)
  • Author
    Posts
  • #130591

    I have been trying to get a VBS script written to change DNS entries on local servers but have been having mad problems. The first problem is deleting all old entries.

    Ok I have found this script below but the problems I will run into is that there are 2 active connections, one that needs to be changed and the other that should be changed at all.

    LAN1
    LAN2

    Quote:
    On Error Resume Next
    strComputer = “.”
    Set objWMIService = GetObject(“winmgmts:\” & strComputer & “rootcimv2”)
    Set colNetCards = objWMIService.ExecQuery _
    (“Select * From Win32_NetworkAdapterConfiguration Where IPEnabled = True”)
    For Each objNetCard in colNetCards
    arrDNSServers = Array(“192.168.1.77”)
    objNetCard.SetDNSServerSearchOrder(arrDNSServers)
    Next

    Can anyone give me advise or point me in a better direction?
    Thanks,
    Certifiedgeek05

Viewing 1 post (of 1 total)

You must be logged in to reply to this topic.