Script for change configuration Preferred DNS server and Alternate DNS server

Discussion in 'Scripting' started by Marius Mag, May 30, 2005.

  1. Marius Mag

    Marius Mag Guest

    Hi

    This is a script for change IP, Subnet mask and gateway:



    "

    Set wshshell = wscript.CreateObject("wscript.shell")



    LACName = "Local Area Connection" 'daca nume placa este Local Area
    Connection



    'setare IP Address, Subnet Mask, Default Gateway

    wshshell.Run "netsh interface ip set address name=" & chr(34) & LACName &
    chr(34) & _

    " source=static addr=192.168.10.230 mask=255.255.0.0
    gateway=192.168.100.10 " & _

    "gwmetric=1", 0, true

    "

    I want to do script for change configuration Preferred DNS server and
    Alternate DNS server, any ideas?



    Thanks!
     
    Marius Mag, May 30, 2005
    #1
    1. Advertisements

  2. Marius Mag

    Umesh Thakur Guest

    All your interface configuration information can be dumped using NETSH:

    c:\>netsh interface ip dump

    Save the output of this command in a text file. then from ur wscript file, run
    following command:

    netsh exec "textfile.txt"

    where textfile.txt is the file where u copied the netsh config dump. I also
    assume that u have made any configuration changes that u would like DNS
    primary and
    secondary settings in text file after saving the dump. do note also that
    before
    dumping the netsh interface conf, add a secondary DNS in ip config using
    normal method.

    Regards,
    Umesh
     
    Umesh Thakur, May 31, 2005
    #2
    1. Advertisements

  3. Marius Mag

    Marius Mag Guest

    Thanks, Umesh !

    That 's exactly I want.



     
    Marius Mag, Jun 1, 2005
    #3
    1. Advertisements

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments (here). After that, you can post your question and our members will help you out.