Announcement

Collapse
No announcement yet.

how can I use netsh to set and add multiple DNS server addresses on remote PC's

Collapse
X
  • Filter
  • Time
  • Show
Clear All
new posts

  • how can I use netsh to set and add multiple DNS server addresses on remote PC's

    Hello All!

    This is my first posting. Can someone help me with how to use NETSH to set and add multiple DNS server addresses to remote PCs that are running Windows XP and Windows
    98.

    I have created a batch file (.bat) with the following entries:

    netsh interface ip set dns name="Local Area Connection" static
    192.168.1.1
    netsh interface ip add dns name="Local Area Connection" 192.168.1.230

    This works fine, changes the DNS entries on the local PC when logged in
    as the Administrator. How can I make this work when a standard USER is
    logged in?

    My preference would be to take input from a .txt file with many IP
    addresses (pcs.txt) and run the "netsh interface ip add dns" command
    within a .bat in order to update the DNS entries.

    This is what I have used before to run other commands on remote systms.
    "for /f %%i in (pcs.txt) do uptime \\%%i >> uptimes1.csv"


    So I tried to place the line below in a .bat
    "for /f %%i in (pcs.txt) do netsh interface ip set dns name="Local Area
    Connection" static 192.168.1.1 \\%%i"


    This yielded ERROR------> \\192.168.1.110 is not an acceptable value
    for register


    I realize I can do this with a GPO which would include a Startup
    script, but these systems are not part of a AD Domain.


    Can someone help please?

    Thanks in advance for your help - Jorge

  • #2
    Re: how can I use netsh to set and add multiple DNS server addresses on remote PC's

    Try
    Code:
    "for /f %%i in (pcs.txt) do netsh -r %%i interface ip set dns name="Local Area 
    Connection" static 192.168.1.1"
    Guy Teverovsky
    "Smith & Wesson - the original point and click interface"

    Comment


    • #3
      Re: how can I use netsh to set and add multiple DNS server addresses on remote PC's

      Thanks Guy!

      I made the change but I received an error:

      The following command was not found: interface ip set dns "name=Local Area Connection" static 192.168.1.1

      Looks like it does not like the syntax after the %%i

      for /f %%i in (pcs.txt) do netsh -r %%i interface ip set dns name="Local Area Connection" static 192.168.1.200

      I would appreciate any additional input.

      Thnx -Jorge

      Comment

      Working...
      X