Announcement

Collapse
No announcement yet.

repair network connection : shell command

Collapse
X
  • Filter
  • Time
  • Show
Clear All
new posts

  • repair network connection : shell command

    Hi,

    Is there a command to "repair network connection" ?

    Could not find any information on google.

    The network connection has a Static IP setup (not DHCP).

    Thank you.
    Sandeep

  • #2
    Re: repair network connection : shell command

    According to this article: http://www.windowsitpro.com/Article/...1060.html?Ad=1, there are a number of commands that are executed when you choose Repair from the context menu of the network connection.
    I assume it won't be a problem for you to write a CMD file containing these commands, am I right?
    I hope that this solution is OS independent, since you did not specify what OS are you referring too.

    Sorin Solomon


    In order to succeed, your desire for success should be greater than your fear of failure.
    -

    Comment


    • #3
      Re: repair network connection : shell command

      Thx Sorinso

      The OS is XP, 2k3.

      I think I found the commands I was looking for.
      I will try them tomorrow.

      Bye for now

      Comment


      • #4
        Re: repair network connection : shell command

        Originally posted by sandeep_from View Post
        Thx Sorinso

        The OS is XP, 2k3.

        I think I found the commands I was looking for.
        I will try them tomorrow.

        Bye for now

        If you found the solution how about sharing?

        Thanks,
        Andrew

        ** Remember to give credit where credit is due and leave reputation points sigpic where appropriate **

        Comment


        • #5
          Re: repair network connection : shell command

          The one i usually use is

          ipconfig /renew

          Comment


          • #6
            Re: repair network connection : shell command

            Here's what the repair option on a Network Connection does:

            http://support.microsoft.com/kb/289256/EN-US/

            SUMMARY

            This article describes what actions are taken if you select the Repair option on a local area network (LAN) or high-speed Internet connection.

            MORE INFORMATION

            The following actions are taken if you select the Repair option on a LAN or high-speed Internet connection.

            NOTE: The actions occur in the order that they are listed. A corresponding command is listed next to each action.

            • Dynamic Host Configuration Protocol (DHCP) lease is renewed: ipconfig /renew
            • Address Resolution Protocol (ARP) cache is flushed: arp -d *
            • Reload of the NetBIOS name cache: nbtstat -R
            • NetBIOS name update is sent: nbtstat -RR
            • Domain Name System (DNS) cache is flushed: ipconfig /flushdns
            • DNS name registration: ipconfig /registerdns

            The following action has been added to Windows XP Service Pack 1:

            • IEEE 802.1X Authentication Restart
            Good to know as we're always suggesting bits of this to posters.

            EDIT: Included this to correct inaccuracies / incompleteness in the WindowsITPro article.
            Last edited by rvalstar; 16th March 2007, 09:49.
            Cheers,

            Rick

            ** Remember to give credit where credit is due and leave reputation points sigpic where appropriate **

            2006-2099 R Valstar. This post is offered "as is" for discussion purposes only with no express or implied warranty of any kind including, but not limited to, correctness or fitness for use. Nothing herein shall be construed as advice. Attempting any activity based on information in this post is done at your own risk.

            Comment


            • #7
              Re: repair network connection : shell command

              Originally posted by rvalstar View Post
              Included this to correct inaccuracies / incompleteness in the WindowsITPro article.
              Rick, can you tell me please what are the inaccuracies in the WindowsITPro article ? I couldn't find the difference.
              Just curious

              Sorin Solomon


              In order to succeed, your desire for success should be greater than your fear of failure.
              -

              Comment


              • #8
                Re: repair network connection : shell command

                Order of the commands (ipconfig /flushdns comes after nbtstat -RR). Also, no specific spell out of ipconfig /renew as the command used. No mention of 802.1 (not that there is a command equiv.)

                MS is "the" source and provided a nice KB on this one. I just always find WindowsITPro articles a bit lacking.

                As an aside, also note for WiFi adapters the process includes disable / enable (restart) steps at the front end but I couldn't find anything as pointed as the MS KB nor any referenced command line equivalents.

                EDIT: Just found this if you want to disable / enable a WiFi adapter as part of the command line repair process:

                http://support.microsoft.com/default...;EN-US;Q311272

                It's a bit icky as you need to correlate an ID to a Description.

                devcon find * > x.txt

                Search x.txt for your WiFi. In my case:

                PCI\VEN_168C&DEV_001A&SUBSYS_EE241113&REV_01\4&1F7 DBC9F&0&18F0: SMCWPCI-G 54Mbps Wireless PCI adapter

                Take everything up to the first & (it will work w/ the long string up to : but you will see some extraneous errors for every &... bit)

                So in my case:

                devcon disable PCI\VEN_168C
                devcon enable PCI\VEN_168C

                I realize the OP was not asking about WiFi but it may come in handy for someone else.
                Last edited by rvalstar; 16th March 2007, 11:32.
                Cheers,

                Rick

                ** Remember to give credit where credit is due and leave reputation points sigpic where appropriate **

                2006-2099 R Valstar. This post is offered "as is" for discussion purposes only with no express or implied warranty of any kind including, but not limited to, correctness or fitness for use. Nothing herein shall be construed as advice. Attempting any activity based on information in this post is done at your own risk.

                Comment


                • #9
                  Re: repair network connection : shell command


                  I met discrepancies in MS KBs too... Nevertheless, I often check MS KBs database, and very rarely WindowsITPro site. Now, with your opinion about them, I'll have less remorses for not checking them more frequently
                  BTW, does the order of these two specific commands count? After all, one is NetBIOS related and the other one deals with DNS...

                  Sorin Solomon


                  In order to succeed, your desire for success should be greater than your fear of failure.
                  -

                  Comment


                  • #10
                    Re: repair network connection : shell command

                    Don't think that particular ordering matters.

                    And you're right, all sources have their errors. The MS KB was just so to-the-point that I couldn't resist. WindowsITPro annoys me as I have to click past the advert then I often have to logon to see that last paragraph.

                    I was really looking for a command line way to repair WiFi. Note my edit above on devcon. If anybody finds a nicer tool, I'd like to hear about it.
                    Cheers,

                    Rick

                    ** Remember to give credit where credit is due and leave reputation points sigpic where appropriate **

                    2006-2099 R Valstar. This post is offered "as is" for discussion purposes only with no express or implied warranty of any kind including, but not limited to, correctness or fitness for use. Nothing herein shall be construed as advice. Attempting any activity based on information in this post is done at your own risk.

                    Comment


                    • #11
                      Re: repair network connection : shell command

                      Originally posted by rvalstar View Post
                      I was really looking for a command line way to repair WiFi. Note my edit above on devcon. If anybody finds a nicer tool, I'd like to hear about it.
                      For disabling and enabling devices by commandline you need devcon.
                      But you can use devon in a vb-script, that can detect wireless interfaces.

                      The script should first enumerates all the sub keys underneath the key HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Contro l\Network\{4D36E972-E325-11CE-BFC1-08002BE10318}\ to find values of MediaSubType that are found only in a subkey called 'connection'. When the value is 2 that means this subkey belongs to a wireless card.
                      Then the script checks if IPEnabled=TRUE (adapter is enabled) and determine in that same key SettingID\connections the strValue of PnpInstanceID.
                      That value is used to run devcon (objShell.Run "\\path\devcon.exe disable ""@" & strValue & """" ,2,True
                      -Wait, till it is fully disabled
                      then enable the adapter again by using devcon.exe enable with the same variables.

                      You can use the same script for clearing the cashes.

                      If you want to repair the LAN attachted interface, then do not query for MediaSubType, but find out a way to reconize that particular NIC on the computer.

                      \Rem

                      This posting is provided "AS IS" with no warranties, and confers no rights.

                      __________________

                      ** Remember to give credit where credit's due **
                      and leave Reputation Points for meaningful posts

                      Comment


                      • #12
                        Re: repair network connection : shell command

                        Thanks Rems -- I'll have to give it a try.

                        I also now see the "@" business and these instance ID's

                        These work (4th being the "best / most complete" -- based on Rems' Shell.Run above):

                        Code:
                        devcon disable PCI\VEN_168C
                        devcon disable @PCI\VEN_168C*
                        devcon disable "@PCI\VEN_168C*"
                        devcon disable "@PCI\VEN_168C&DEV_001A&SUBSYS_EE241113&REV_01\4&1F7 DBC9F&0&18F0"
                        And this works but each & is considered another command on the line so you get a bunch of '...' is not recognized...

                        Code:
                        devcon disable PCI\VEN_168C&DEV_001A&SUBSYS_EE241113&REV_01\4&1F7 DBC9F&0&18F0
                        But these don't work:

                        Code:
                        devcon disable @PCI\VEN_168C
                        devcon disable @PCI\VEN_168C&DEV_001A&SUBSYS_EE241113&REV_01\4&1F7 DBC9F&0&18F0
                        devcon disable "PCI\VEN_168C&DEV_001A&SUBSYS_EE241113&REV_01\4&1F7 DBC9F&0&18F0"
                        Last edited by rvalstar; 16th March 2007, 15:49.
                        Cheers,

                        Rick

                        ** Remember to give credit where credit is due and leave reputation points sigpic where appropriate **

                        2006-2099 R Valstar. This post is offered "as is" for discussion purposes only with no express or implied warranty of any kind including, but not limited to, correctness or fitness for use. Nothing herein shall be construed as advice. Attempting any activity based on information in this post is done at your own risk.

                        Comment


                        • #13
                          Re: repair network connection : shell command

                          @sandeep_from

                          My apologies for taking this off into a repair for WiFi connections and an disable/enable device discussion.

                          Certainly helped me (and a few of my road warrior cohorts) out.

                          So in the end, what set of commands did you decide on to repair your Network Connection?
                          Cheers,

                          Rick

                          ** Remember to give credit where credit is due and leave reputation points sigpic where appropriate **

                          2006-2099 R Valstar. This post is offered "as is" for discussion purposes only with no express or implied warranty of any kind including, but not limited to, correctness or fitness for use. Nothing herein shall be construed as advice. Attempting any activity based on information in this post is done at your own risk.

                          Comment

                          Working...
                          X