locked
Scripting static IP settings on WHS RRS feed

  • Question

  • Hi,

    I have two servers running and need to switch addresses regulary. Is there a way to create a batch file (or other script) to set IP etc on the WHS?

    Thanks

    Sam

    Wednesday, May 12, 2010 10:32 AM

Answers

  • You can use the netsh command line tool to change networking settings. netsh int or netsh interface (they're the same subcommand) is what you'll need, and typing netsh int -? in a command prompt will get you help. You could also take a look on Technet where you'll find documentation on the netsh command, or use a search engine .
    I'm not on the WHS team, I just post a lot. :)
    • Proposed as answer by Ken WarrenModerator Wednesday, May 12, 2010 1:35 PM
    • Marked as answer by wheatism Wednesday, May 12, 2010 4:37 PM
    Wednesday, May 12, 2010 1:35 PM
    Moderator

All replies

  • You can use the netsh command line tool to change networking settings. netsh int or netsh interface (they're the same subcommand) is what you'll need, and typing netsh int -? in a command prompt will get you help. You could also take a look on Technet where you'll find documentation on the netsh command, or use a search engine .
    I'm not on the WHS team, I just post a lot. :)
    • Proposed as answer by Ken WarrenModerator Wednesday, May 12, 2010 1:35 PM
    • Marked as answer by wheatism Wednesday, May 12, 2010 4:37 PM
    Wednesday, May 12, 2010 1:35 PM
    Moderator
  • Thanks Ken, I knew there must be a command!

    Wednesday, May 12, 2010 4:38 PM
  • I use this regularly as my laptop needs to connect to various systems with different ip's. I can never remember what they are.

    I found these on the web and modified them for my use.

    Static ip:

    netsh interface ip set address name="Local Area Connection" source=static addr=111.222.333.444 mask=255.255.255.255
    netsh interface ip set address name="Local Area Connection" gateway=555.666.777.888 gwmetric=0
    netsh interface ip set dns name="Local Area Connection" source=static addr=999.111.222.333 
    netsh interface ip add dns name = "Local Area Connection" addr = 444.555.666.77

    DHCP:

    netsh interface ip set address name="Local Area Connection" dhcp
    netsh interface ip set dns name="Local Area Connection" dhcp

    Copy text into notepad mdify to your needs and rename to .bat

    Thursday, May 13, 2010 4:57 PM