Jump to content


 

need a method to change IP gateway only by script


4 replies to this topic

#1 speedi

    Advanced Member

  • Full Members
  • PipPip
  • 127 posts
  • Gender:Male
  • Location:Lehigh Valley, Penna.

Posted 05 May 2008 - 02:34 PM

I need to change the IP gateway on a number of systems and thought it would be faster if I developed a script. Research I have done indicates use of NETSH, but I have not found command line to change the GATEWAY only... All systems have a static IP address... Thanks for any help provided....!



#2 weaponx

    I'm coming for blood, no code of conduct, no law.

  • AutoIt MVPs (MVP)
  • 5,365 posts
  • Gender:Male
  • Location:Ohio

Posted 05 May 2008 - 03:10 PM

You can use netsh:

[ code='text' ]    ( Popup )
netsh interface ip add address "local area connection" gateway=100.1.1.5 gwmetric=2

Posted Image

My empty homepage: http://www.fallenstar.net


#3 speedi

    Advanced Member

  • Full Members
  • PipPip
  • 127 posts
  • Gender:Male
  • Location:Lehigh Valley, Penna.

Posted 05 May 2008 - 03:29 PM

View Postweaponx, on May 5 2008, 09:10 AM, said:

You can use netsh:

[ code='text' ]    ( Popup )
netsh interface ip add address "local area connection" gateway=100.1.1.5 gwmetric=2


RunWait("netsh interface ip add address ""local area connection"" gateway=100.1.1.5 gwmetric=2")

that worked great! Thanks!

#4 speedi

    Advanced Member

  • Full Members
  • PipPip
  • 127 posts
  • Gender:Male
  • Location:Lehigh Valley, Penna.

Posted 05 May 2008 - 08:49 PM

View Postweaponx, on May 5 2008, 09:10 AM, said:

You can use netsh:

[ code='text' ]    ( Popup )
netsh interface ip add address "local area connection" gateway=100.1.1.5 gwmetric=2


Question: What does the gwmetric=2 accomplish???? Thanks!

#5 weaponx

    I'm coming for blood, no code of conduct, no law.

  • AutoIt MVPs (MVP)
  • 5,365 posts
  • Gender:Male
  • Location:Ohio

Posted 05 May 2008 - 08:50 PM

View Postspeedi, on May 5 2008, 02:49 PM, said:

Question: What does the gwmetric=2 accomplish???? Thanks!

Not sure but I don't think it will work without it. See here:
http://technet2.microsoft.com/windowsserve...3.mspx?mfr=true

Edited by weaponx, 05 May 2008 - 08:52 PM.

Posted Image

My empty homepage: http://www.fallenstar.net






1 user(s) are reading this topic

0 members, 1 guests, 0 anonymous users