Home All Groups Group Topic Archive Search About

Detect which SSID I'm connecting to with the command line

Author
2 Nov 2006 4:38 PM
nickj6282
Hi,

I take my notebook lots of different places, and some require a static IP
setup, while others have DHCP. I've finally learned the beauty of netsh.exe,
and I've created a few batch files to configure my IP differently in
different places. Does anyone know how to detect the SSID or MAC that my wifi
card has connected to from the command line so that I can create a batch to
run at Windows startup and configure the IP address appropriately?

Thanks,
-Nick

Author
2 Nov 2006 11:28 PM
Jack (MVP-Networking).
Hi
It is not clear to me what you are using as an OS and Wireless mangar in
order to connect..
If you use WinXP with windows Zero Configuration, then once you are
connetced to an Open public HotSpot No futher configuarion is neccesary. If
you are not connetect then you can not get info about a Network that you can
not connect to.  If a network needs static IP there is No way to detect
which IP to use (unless the network owner tells you) since you can not
connect to the Network in order to find the IP subnet.
This program can give info about available Hot Spot,
http://www.netstumbler.com
Jack (MVP-Networking).

Show quoteHide quote
"nickj6282" <nickj6***@discussions.microsoft.com> wrote in message
news:AF5B2A21-BA3F-4885-AA69-150BC117D965@microsoft.com...
> Hi,
>
> I take my notebook lots of different places, and some require a static IP
> setup, while others have DHCP. I've finally learned the beauty of
> netsh.exe,
> and I've created a few batch files to configure my IP differently in
> different places. Does anyone know how to detect the SSID or MAC that my
> wifi
> card has connected to from the command line so that I can create a batch
> to
> run at Windows startup and configure the IP address appropriately?
>
> Thanks,
> -Nick
Author
3 Nov 2006 4:36 AM
nickj6282
I don't think you understood. In the Wireless Zero Configuration, I have
several SSIDs preset to connect when in range (i.e. one at home, one at
school, etc.) What I want to do is when I start my laptop, run a batch that
will figure out which of the pre-defined SSIDs is in range, then assign the
pre-set IP address for that SSID (that I already have).

So like this basically:

if ssid = 'my home ssid' then set IP address to DHCP
if ssid = 'school' then set IP address to 172.30.1.138, default gateway...
etc.
if ssid = 'work' then set IP address to 10.100.128.251, default gateway...
etc.

....and so on. All in a batch file so it can run at Windows startup, or I can
just double click it and go.
Author
3 Nov 2006 4:53 PM
Jack (MVP-Networking).
Hi

I do not think it can be done the way you define it.

However, you can use software like this,
http://www.globesoft.com/mnm8_home.asp

To predefine the setting of all your connections that you are using, and
choose the one that you want to connect to.

Jack (MVP-Networking).



Show quoteHide quote
"nickj6282" <nickj6***@discussions.microsoft.com> wrote in message
news:81F6561F-A6EE-4059-A834-D704588EF925@microsoft.com...
>I don't think you understood. In the Wireless Zero Configuration, I have
> several SSIDs preset to connect when in range (i.e. one at home, one at
> school, etc.) What I want to do is when I start my laptop, run a batch
> that
> will figure out which of the pre-defined SSIDs is in range, then assign
> the
> pre-set IP address for that SSID (that I already have).
>
> So like this basically:
>
> if ssid = 'my home ssid' then set IP address to DHCP
> if ssid = 'school' then set IP address to 172.30.1.138, default gateway...
> etc.
> if ssid = 'work' then set IP address to 10.100.128.251, default gateway...
> etc.
>
> ...and so on. All in a batch file so it can run at Windows startup, or I
> can
> just double click it and go.
Author
5 Nov 2006 12:13 AM
Pavel A.
"nickj6282" wrote:
> So like this basically:
>
> if ssid = 'my home ssid' then set IP address to DHCP
> if ssid = 'school' then set IP address to 172.30.1.138, default gateway...
> etc.
> if ssid = 'work' then set IP address to 10.100.128.251, default gateway...
> etc.

Hmm. maybe this can be done with WMI :  MSNdis_80211_ServiceSetIdentifier
class (and you'll have to use vbscript instead of bat files) - however I
haven't tried this yet.

Regards,
--PA