Enable DNS to obtain address's automatically

Discussion in 'Scripting' started by David Pearce, Jun 9, 2004.

  1. David Pearce

    David Pearce Guest

    I found a VB script to enable DNS on a client computer, but was unable to
    find one that changes a client that has static DNS entries to obtain their
    DNS server address's from DHCP. Does anyone know how to script this?
    David Pearce, Jun 9, 2004
    1. Advertisements

  2. You can use the NetShell utility to do this.

    netsh interface ip set dns name="Local Area Connection" source=dhcp
    Patrick Ogenstad, Jun 9, 2004
    1. Advertisements

  3. David Pearce

    MartinHTN Guest

    Try adding this to your script:

    For Each objNIC In colNIC
    errDNS = objNIC.SetDNSServerSearchOrder() 'Clears all
    static DNS servers
    errEnableDHCP = objNIC.EnableDHCP() 'Enables DHCP
    MartinHTN, Jun 9, 2004
    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.