Results 1 to 6 of 6

Thread: Script to erase DNS and WINS addresses

  1. #1
    Join Date
    Dec 2009
    Posts
    178

    Script to erase DNS and WINS addresses

    Hello,
    I have my pc business notebook that I use at home. The trouble is that for my internet connection at home have to delete the DNS and WINS servers came hard. Someone has a solution for launching a startup file that would give me the choice between my connection at work or my connection at work. I would like especially to know how to create a small program that could erase my DNS and WINS addresses. Thank you to you.
    Last edited by New ID; 14-01-2010 at 08:06 PM.

  2. #2
    Join Date
    May 2008
    Posts
    3,516

    Re: Script to erase DNS and WINS addresses

    Hello
    Here is a small batch that can do what you ask
    :: @ ECHO off
    :: Change the IP settings of the machine
    netsh interface ip set address "Connection" source = dhcp
    :: Change primary DNS server
    netsh interface ip set dns "Connection" source = dhcp
    :: Added context WINS
    netsh interface ip delete wins "Connection" all
    :: To disable the use of Internet Explorer Proxy
    Reg add "HKEY_CURRENT_USER \ Software \ Microsoft \ Windows \ CurrentVersion \ Internet Settings" / v ProxyEnable / t REG_DWORD / d 00000000 / f
    Note that in the batch lines NetSh above, the "Connection" shall be replaced by the name of the connection that you want to edit. To take into account also that the batches are DOS commands, it is strongly recommended to use long names and / or accents in the name of the connection.

  3. #3
    Join Date
    Dec 2009
    Posts
    178

    Re: Script to erase DNS and WINS addresses

    Hello,
    Thank you for your answer but when I execute the file, I get an error:
    Windows Script HostScript: c: \ .....
    Line: 1
    Attrib: 3
    Code: 800A0408
    Source: compiles error microsoft vbscript.
    Here is my file
    :: @ ECHO off
    :: Change the IP settings of the machine
    netsh interface ip set address Local Area Connection source = dhcp
    :: Change primary DNS server
    netsh interface ip set dns Local Area Connection source = dhcp
    :: Added context WINS
    netsh interface ip delete wins all Local Area Connection
    :: To disable the use of Internet Explorer Proxy
    Reg add "HKEY_CURRENT_USER \ Software \ Microsoft \ Windows \ CurrentVersion \ Internet Settings" / v ProxyEnable / t REG_DWORD / d 00000000 / f
    Am I wrong somewhere?

  4. #4
    Join Date
    May 2008
    Posts
    3,516

    Re: Script to erase DNS and WINS addresses

    Hi,
    You need include your name in connection quotes
    : Changing IP settings of the machine
    netsh interface ip set address "Local Area Connection" source = dhcp
    This is how you can do fix your code. Hope this helps you.

  5. #5
    Join Date
    Jan 2006
    Posts
    3,792

    Re: Script to erase DNS and WINS addresses

    Hi,
    Personally, I created a small file .Bat when I had some difficulties, these are the main part of the code.
    netsh interface ip set DNS "Local Area Connection" static xxx.xxx.xxx.xxx
    And
    netsh interface ip set WINS "Local Area Connection" static xxx.xxx.xxx.xxx
    I had used this to set fixed addresses. If you wish you can try this.

  6. #6
    Join Date
    May 2008
    Posts
    2,945

    Re: Script to erase DNS and WINS addresses

    Hello,
    netsh interface ip set DNS "Local Area Connection" dhcp
    netsh interface ip set WINS "Local Area Connection" dhcp
    You can use this to return to DHCP
    Is it more advantageous to make a vbs from the bat? Even you can use this
    netsh interface ip set address "Local Area Connection" dhcp
    in the last code, normally everything should be configured automatically.

Similar Threads

  1. Word 2008 + bibfuse: no script in script menu
    By deval4u in forum Software Development
    Replies: 5
    Last Post: 06-04-2009, 12:53 PM
  2. Replies: 2
    Last Post: 14-01-2009, 01:25 PM
  3. Serena wins US Open
    By GaryK in forum Off Topic Chat
    Replies: 0
    Last Post: 08-09-2008, 12:47 PM
  4. Replies: 4
    Last Post: 24-04-2008, 06:50 PM
  5. Do I or do I not need a WINS server? :)
    By Jim in forum Active Directory
    Replies: 5
    Last Post: 12-12-2007, 12:54 AM

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Page generated in 1,713,481,038.21502 seconds with 17 queries