Windows Vista Forums

Grabbing IP address then setting to 2nd nic
  1. #1


    drunkeninja Guest

    Grabbing IP address then setting to 2nd nic

    I am trying to combine code which grabs the ip address of a server
    from
    http://groups.google.com/group/micro...751466d5406803

    then set it to a 2nd NIC via the netsh command

    netsh interface ip set address "Local Area Connection 2" static IP
    ADDRESS



    is it possible to set this as a variable obtained from code in the 1st
    part???

    Also have been trying to use the the netsh command for only the
    ipaddress without wiping the rest of the details ie subnet/default
    gateway/dns etc.

      My System SpecsSystem Spec

  2. #2


    Pegasus \(MVP\) Guest

    Re: Grabbing IP address then setting to 2nd nic


    "drunkeninja" <shaolindriver@xxxxxx> wrote in message
    news:767ff9c7-53af-4412-986b-868e09f80e08@xxxxxx

    >I am trying to combine code which grabs the ip address of a server
    > from
    > http://groups.google.com/group/micro...751466d5406803
    >
    > then set it to a 2nd NIC via the netsh command
    >
    > netsh interface ip set address "Local Area Connection 2" static IP
    > ADDRESS
    >
    > is it possible to set this as a variable obtained from code in the 1st
    > part???
    >
    > Also have been trying to use the the netsh command for only the
    > ipaddress without wiping the rest of the details ie subnet/default
    > gateway/dns etc.
    Since netsh.exe is a console command, it would simplify things
    considerably if you used a batch file to extract and set your
    IP address instead of shelling out of a VB Script. The following
    code will do it:

    1. @echo off
    2. net start | find /i "Routing and Remote Access" > nul && goto Netsh
    3. sc config "RemoteAccess" start= demand
    4. net start "RemoteAccess"
    5.
    6. :Netsh
    7. for /F %%a in ('netsh interface ip show ipaddress ^| find /i "wireless"')
    do set IP=%%a
    8. echo IP=%IP%

    You must replace the word "wireless" with a non-ambiguous word
    of your own NIC as shown in the Interface column of the command

    netsh interface ip show ipaddress

    Be careful with Line 3 - the space following the = is critical.



      My System SpecsSystem Spec

Grabbing IP address then setting to 2nd nic problems?

Similar Threads
Thread Thread Starter Forum Replies Last Post
setting up apple e-mail address crl Vista mail 2 30 Oct 2009
Vista assigns 0.0.0.0 IP address when setting up static IP romeropaul Vista networking & sharing 2 05 Jun 2008
setting for replies: receiver address - not default address strunz Vista mail 7 27 Jan 2008
Setting up Hotmail address mikemaber Vista General 10 16 Jan 2008
MAC address setting on Vista jcage@lycos.com Vista networking & sharing 2 26 Jul 2007