Welcome!

By registering with us, you'll be able to discuss, share and private message with other members of our community.

SignUp Now!

Programmatically Determine Which Network Connected To

Aug
1,929
71
I am using;

Code:
TCC  15.01.55  Windows Vista [Version 6.0.6002]
TCC Build 55  Windows Vista Build 6002  Service Pack 2

In the system tray, I have the network icon enabled, which, when I pass the mouse over it, tells me which wireless network I am connected to, either WIND-F123t, or AndroidAP1234.

I have been googling all over the place, looking for a command line utility which will tell me what wireless network I have active.

I could write my own utility, but not sure what API to call. I have looked into the NLM (Network List Manager) at http://msdn.microsoft.com/en-us/library/windows/desktop/aa370803(v=vs.85).aspx and think this might be my starting point.

I have several batch files, that I only want to run when connected to a specific wireless network. At present, I must determine this manually, as discussed previously.

If anyone has already done something like this, or can provide positive suggestions, it would be appreciated.

Joe
 
Joe:
If there are systems connected to each network that are unique to a specific network, a quick work-around would be to determine their accessibility, e.g., by NET USE or by the "Network properties" category of TCC functions. Not as elegant as a direct test, but a possible work-around.
 
I know that IPCONFIG returns some of that information. Also NETSH WLAN SHOW should contain the information you seek. I don't have a wireless interface on my work PC, so I can't check until I get home.
 
You may also play around with the WMIQUERY command.
Code:
wmiquery /ab . "SELECT * FROM   Win32_NetworkAdapter"

I don't know if that contains the info you need or not.
 
Also NETSH WLAN SHOW should contain the information you seek.

Thanks Scott, NETSH more than solved my problems. I had forgotten all about that command.

I can now;

Code:
netsh wlan disconnect

then

Code:
netsh wlan connect name=WIND-E486Es-12f3

or

Code:
netsh wlan connect name=AndroidAP1234

and

Code:
netsh wlan show interfaces

to see which interface is active.

Next task is to incorporate them into my .btm files, make functions, etc., unless TCMD V16 comes out soon, which I just learned about from this public forum, which, I understand, cannot be discussed, which may eliminate my need for these commands. But I digress...

Joe
 
Back
Top