Results 1 to 5 of 5

Thread: is there a network object to change IP?

  1. #1

    Thread Starter
    New Member
    Join Date
    Jan 1999
    Location
    Albany, NY, USA
    Posts
    15

    Question

    I have a user who goes between two different places and we would like to set up his laptop so that he could easily configure his machine on either network.
    I thought perhaps we could write some VBScript and use the Windows Scripting Host...but I don't know if there is any objects that I can use to get to his IP address and his subnet mask and gateway and anything else. So, is there anyway to get to this properties through WSH?

    Thanks
    --Dan

  2. #2
    Addicted Member
    Join Date
    May 2000
    Posts
    142
    this doesnt really answer your question, but i know you can get a user's IP in ASP with

    Code:
    Request.ServerVariables("REMOTE_ADDR")
    dvst8
    Secret to long life:
    Keep breathing as long as possible.

  3. #3

    Thread Starter
    New Member
    Join Date
    Jan 1999
    Location
    Albany, NY, USA
    Posts
    15
    No, you're right, it doesn't at all.

    I'm not talking about a client IP.
    And I'm not talking about ASP or web use at all, so there is no request object.

    I'm talking about a script that would run in windows (thanks to the Windows Scripting Host) and be able to change the assigned IP address of the OS.

    but thanks for trying I guess.
    (:


  4. #4
    Addicted Member
    Join Date
    May 2000
    Posts
    142

    ouch

    sorry man
    Secret to long life:
    Keep breathing as long as possible.

  5. #5
    New Member
    Join Date
    Jul 2007
    Location
    Suffolk
    Posts
    4

    Re: is there a network object to change IP?

    I realise that this is an old thread, but while looking for some help with using Windows Scripting Host in VB .NET 2005 I came accross it, and having run into this problem myself I thought I would post my solution.

    I have been using this method successfully moving my XP laptop between work and home for the last year or so with no problems.

    All you need to do is make the relevant settings in the batch file, and then save it with a meaningful name, and have the user double click the correct one dependent on location.

    If the user has different user accounts for different locations then just put it in the startup folder.

    This batch file will set the IP address of the computer to a static address:
    Code:
    @echo off
    
    echo Automatic IP Address settings v1.0
    echo written February 2006 by James Howell
    
    
    echo Configuring IP Address:
    rem set the fixed IP address
    rem settings are in the format: connection name | type | ip | subnet | gateway
    netsh interface ip set address "Local Area Connection" static 172.20.25.7 255.255.0.0 172.20.0.2 1
    
    echo.
    
    echo Configuring DNS Address:
    rem This line appears twice to allow for the primary and secondary DNS server settings
    netsh interface ip set dns "Local Area Connection" static addr=172.20.10.2
    netsh interface ip add dns "Local Area Connection" 172.20.10.1 index=1
    echo.
    
    
    echo The following details have been set:
    rem echo the settings back to the user
    netsh interface ip show config name="Local Area Connection"
    echo.
    
    rem wait for the user to exit the program
    echo Press any key to exit
    pause > Nul
    
    exit

    This batch file will set the IP address of the computer to a dynamic address:
    Code:
    @echo off
    
    echo Automatic IP Address settings v1.0
    echo written February 2006 by James Howell
    
    
    echo Configuring IP Address:
    rem set the dynamic IP address
    netsh interface ip set address name="Local Area Connection" source=dhcp
    echo.
    
    echo Configuring DNS Address:
    rem set the dynamic dns address
    netsh interface ip set dns name="Local Area Connection" source=dhcp
    echo.
    
    
    echo The following details have been set:
    rem echo the settings back to the user
    netsh interface ip show config name="Local Area Connection"
    echo.
    
    rem wait for the user to exit the program
    echo Press any key to exit
    pause > Nul
    
    exit
    Anyway, that's my solution. If anyone finds it useful, it would be nice if you could let me know.

    James
    Attached Files Attached Files

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width