Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

Basically, if you go to Start and click Computer and then click on the Network link on the left hand side, you'll notice on the right hand side several categories, one of which is titled "Network Infrustructure", in that category, my router is listed, and in my case, it is "LINKSYS WAG160N Wireless-N ADSL2+ Gateway" and when you right-click and select properties, it lists basic info such as internal/gateway IP address, on mine it is "192.168.1.1"

I would like to know how to retreive this information in ie: either registry location or Windows API call or .net framework reference etc, preferably a Windows API or Registry Location so that i can call it using a legacy VB6 app but anything will do at the moment as i am totally lost in this respect.

thanks guys :)

share|improve this question

3 Answers 3

up vote 0 down vote accepted

I got the answer from a superuser post and here is the link... http://superuser.com/questions/194862/how-to-get-router-name-ip-as-shown-in-windows-network-tab-in-code-or-from-reg

basically, turns out you need to look into the upnp.dll insite windows\system32 and learn how to use it by looking up references for the upnp api on msdn! this is how you get the details.

share|improve this answer

Did you ask this at SO? You can parse the output of the "route print -4" to get the default gateway.

share|improve this answer
    
hi dbasnett, i'm trying to get the name of the router that is tied to the particular default gateway/router ip as is shown through the method described above, do you know how to do this? thanks. –  user55887 Oct 13 '10 at 1:38

You could easily get all the information you need using WMI Network classes.
For a simple .Net code with a full implementation, look here.

share|improve this answer
    
thanks for the info, but this just shows the details for my local/client wireless 802.11n wifi card on my computer, this doesn't list or show the actual router, which would be the linksys, i checked through the enumeration. –  user55887 Oct 1 '10 at 20:11
    
Try one of the other WMI classes then. You can still use the code to run through the enumeration –  Traveling Tech Guy Oct 1 '10 at 23:14
    
which WMI class do you think it is likely to be? i'm at a stumbling block! –  user55887 Oct 13 '10 at 1:36

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.