none
How do I make netsh command to read from a file? RRS feed

  • Question

  • I need to change secondary dns setting on multiple remote PCs (they all have static IP settings)! I can use netsh command to do one PC at a time. I need help in netsh command that will read from a text file listing computer names and add dns settings to those PCs, thanks. 

    Thang Mo

    Thursday, April 4, 2013 4:15 PM

Answers

  • I need to change secondary dns setting on multiple remote PCs (they all have static IP settings)! I can use netsh command to do one PC at a time. I need help in netsh command that will read from a text file listing computer names and add dns settings to those PCs, thanks. 

    Thang Mo

    Here you go:

    d:\>netsh /?
    Usage: netsh [-a AliasFile] [-c Context] [-r RemoteMachine] [-u [DomainName\]UserName] [-p Password | *] [Command | -f ScriptFile]

    • Proposed as answer by Chris DeCarlo Thursday, April 4, 2013 9:30 PM
    • Marked as answer by ThangMo Wednesday, April 10, 2013 3:19 PM
    Thursday, April 4, 2013 8:46 PM

All replies

  • You could do a GPO for this.  Under Computer Config -- Administrative Templates -- Network -- DNS Client -- DNS Servers and you can adjust as needed.

    Be kind and Mark as Answer if I helped.

    Thursday, April 4, 2013 5:09 PM
  • Actually, it's in Computer Configuration and it's for Windows XP only. My PCs are Windows 7 pro 32bit. I tried the GPO setting out (domain GPO) and it did not work!

    Thang Mo

    Thursday, April 4, 2013 6:20 PM
  • I need to change secondary dns setting on multiple remote PCs (they all have static IP settings)! I can use netsh command to do one PC at a time. I need help in netsh command that will read from a text file listing computer names and add dns settings to those PCs, thanks. 

    Thang Mo

    Here you go:

    d:\>netsh /?
    Usage: netsh [-a AliasFile] [-c Context] [-r RemoteMachine] [-u [DomainName\]UserName] [-p Password | *] [Command | -f ScriptFile]

    • Proposed as answer by Chris DeCarlo Thursday, April 4, 2013 9:30 PM
    • Marked as answer by ThangMo Wednesday, April 10, 2013 3:19 PM
    Thursday, April 4, 2013 8:46 PM
  • I just did it on a Windows 8 computer with no issue, and i did mention it was in Computer Config.  Very confused now.  Anyway Oberwalds got a switch for the config file you were looking for.

    Be kind and Mark as Answer if I helped.

    Thursday, April 4, 2013 9:30 PM