WMI: SSID, RSSI & MAC address

Joined
Mar 21, 2006
Messages
4
Reaction score
0
I have some problems getting valid/readable data from the WMI classes handling wireless network information. Here's what I got:

ssid0fn.png


This the correct info I want:

netsumbler8wt.png


Code:
     [color=Blue] public static void[/color] GetAvailableNetworks()
      {
      	[color=Blue]try[/color]
      	{
      	   [color=SeaGreen] /*Making the search*/[/color]
      		[color=Blue]string[/color] scope = [color=DarkRed]"root\\WMI"[/color];
      		[color=Blue]string[/color] query = [color=DarkRed]"SELECT * FROM MSNdis_80211_BSSIList"[/color];
      		[color=DeepSkyBlue]ManagementObjectSearcher[/color] mos = [color=Blue]new[/color] [color=DeepSkyBlue]ManagementObjectSearcher[/color](scope, query);
      		[color=DeepSkyBlue]ManagementObjectCollection[/color] moc = mos.Get();
      		[color=DeepSkyBlue]ManagementObjectCollection[/color].[color=DeepSkyBlue]ManagementObjectEnumerator[/color] moe = moc.GetEnumerator();
      		moe.MoveNext();
      		[color=SeaGreen]/*Adapter name*/[/color]
      		[color=DeepSkyBlue]Console[/color].WriteLine([color=DarkRed]"Adapter: "[/color] + moe.Current.Properties[[color=DarkRed]"InstanceName"[/color]].Value);
      		[color=SeaGreen]/*Number of available wireless networks*/[/color]
      		[color=DeepSkyBlue]Console[/color].WriteLine([color=DarkRed]"Available wireless networks: "[/color] + moe.Current.Properties[[color=DarkRed]"NumberOfItems"[/color]].Value);
      		[color=DeepSkyBlue]ManagementBaseObject[/color][] objarr = ([color=DeepSkyBlue]ManagementBaseObject[/color][]) moe.Current.Properties[[color=DarkRed]"Ndis80211BSSIList"[/color]].Value;
      
      		[color=Blue]foreach[/color] ([color=DeepSkyBlue]ManagementBaseObject[/color] queryObj [color=Blue]in[/color] objarr)
      		{
      			[color=SeaGreen]/*One SSID per line (SSID = name of nerwork)*/[/color]
      			[color=DeepSkyBlue]Console[/color].WriteLine([color=DeepSkyBlue]Encoding[/color].ASCII.GetChars(([color=Blue]byte[/color][])queryObj.Properties[[color=DarkRed]"Ndis80211Ssid"[/color]].Value));
      		   [color=SeaGreen]   /*
      			* Other info:
      			* Ndis80211Ssid (Service Set Identifer) (array of uint8) = byte[]
      			* Ndis80211MacAddress (array of uint8) = byte[]
      			* Ndis80211Rssi (Recieved Signal Strength Identifier) (uint32) (Must be converted to dBm :/)
      			*/[/color]
      		}
      	}
      	[color=Blue]catch[/color] ([color=DeepSkyBlue]ManagementException[/color] e)
      	{
      		[color=DeepSkyBlue]Console[/color].WriteLine([color=DarkRed]"An error occurred while querying for WMI data: "[/color] + e.Message);
      	}
      }

Is WMI ****ed up, or am I doing something wrong here?

About the RSSI, I know I can get it in dBm from "MSNdis_80211_RecievedSignalStrength" property, but that's ONLY for the CONNECTED accesspoint.
 
More trouble

Oh, great! Downloaded the latests drivers from Intel (80MB!), and to my pleasant suprise, WMI support was included:thumb: So far, so good. Got connected to the wireless network again, and ran my little app above.

Turns out, WMI can't find an instance of "MSNdis_80211_BSSIList" :mad:


Tried to reinstall, deinstall and install with WMI, without WMI, reboot, etc, nothing worked....:(

Now I'm even off worse when than when I started... :P
 
Spartakus said:
I have some problems getting valid/readable data from the WMI classes handling wireless network information. Here's what I got:

ssid0fn.png


This the correct info I want:

netsumbler8wt.png



hello, i have the same problem as you, have you resolved the problem ??
thanks :)
 
Hello, Did you guys ever manage to find a solution to the problem? I'm finding BSSID_LIST is returning garbage after the first result as you did...

If you could let me know what you found out i'd be very grateful!
 
Back
Top