none
Windows 7 netsh doesn't change IP address

    Question

  • I've been using a script for a long time on Win7 to set the IP address. It has worked fine for a year or so, but recently I've noticed that I'm ending up with 2 IPs in the advanced tab of the IPv4 configuration, with the old IP being active. Just removing it from the list leaves the PC with no IPv4 connectivity. I have to on the main properties screen (which will show the new, correct IP address) set it to DHCP, OK out, go back in and manually type back in the IP to get it to actually re-connect to IPv4 systems.

     

    The script does the following:

    netsh interface ip set address name "Local Area Connection 2" static newIP netmask gateway

     

    Where newIP netmask and gateway are replaced with appropriate IPv4 values. This has always worked in the past to change the IP address... Before this started happening, I didn't even know Win7 could have 2 different fixed IPs at the same time or have a list to choose from or something in that advanced tab...

     

    Any ideas what I ought to do differently to fix this?

    Thursday, March 08, 2012 5:57 PM

Answers

  • Hi,

    You can try the following steps.

    - netsh interface ipv4 reset (It may ask for a reboot, but you can also do that after the next step)

    - netsh interface ip set address name "Local Area Connection 2" static newIP netmask gateway

    - For rebooting you can use "shutdown -r -t 0" { 0 will make the system go for immediate reboot; you might want to change this value as per your convenience).

    Thanks,

    Girish

    -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

    Please remember to click "Vote As Helpful" on the post if the information is useful to you ! Please remember to click “Mark as Answer” on the post that helps you to fix the issues, and to click “Unmark as Answer” if a marked post does not actually answer your question. This can be beneficial to other community members reading the thread. This posting is provided "AS IS" with no warranties or guarantees and confers no rights.


    Friday, March 09, 2012 4:35 AM

All replies

  • Hi,

    You can try the following steps.

    - netsh interface ipv4 reset (It may ask for a reboot, but you can also do that after the next step)

    - netsh interface ip set address name "Local Area Connection 2" static newIP netmask gateway

    - For rebooting you can use "shutdown -r -t 0" { 0 will make the system go for immediate reboot; you might want to change this value as per your convenience).

    Thanks,

    Girish

    -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

    Please remember to click "Vote As Helpful" on the post if the information is useful to you ! Please remember to click “Mark as Answer” on the post that helps you to fix the issues, and to click “Unmark as Answer” if a marked post does not actually answer your question. This can be beneficial to other community members reading the thread. This posting is provided "AS IS" with no warranties or guarantees and confers no rights.


    Friday, March 09, 2012 4:35 AM
  •  

    Hi imp242,

    How’s everything going on? Please feel free to give me any update.

    Thank you  for your cooperation.

    Regards,

    Leo   Huang

    TechNet Subscriber Support

    If you are TechNet Subscription user and have any feedback on our support quality, please send your feedback here.


    Leo Huang

    TechNet Community Support

    Monday, March 12, 2012 1:46 AM
    Moderator
  •  

    Hi,

     

    As this thread has been quiet for a while, we assume that the issue has been resolved. At this time, we will mark it as ‘Answered’ as the previous steps should be helpful for many similar scenarios. If the issue still persists, please feel free to  reply this post directly so we will be notified to follow it up. You can also choose to unmark the answer as you wish.

    BTW,  we’d love to hear your feedback about the solution. By sharing your experience you can help other community members facing similar problems. Thanks for your understanding and efforts.

     

    Regards,

    Leo   Huang

    TechNet Subscriber Support

    If you are TechNet Subscription user and have any feedback on our support quality, please send your feedback here.


    Leo Huang

    TechNet Community Support

    Friday, March 16, 2012 1:29 AM
    Moderator