By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
440,742 Members | 793 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 440,742 IT Pros & Developers. It's quick & easy.

WMI to get SSID and signal strength information

P: n/a
Hi, can anyone help please?

I am trying to get infromation from my wireless card, such as signal
strength and a list of SSIDs that it can see. I have been able to get
the signal strength (see code below), but I cannot get the list of
SSIDs. I have installed WMITools (from Microsoft) to delve in further
and it tells me that there is no instance for MSNdis_80211_WLanBssId
or MSNdis_80211_BSSIList.

The code I used to get the signal strength is below:

----------------------------------------------------------------------------

ListBox2.Items.Clear()
Dim query As Management.ManagementObjectSearcher
Dim Qc As Management.ManagementObjectCollection
Dim Oq As Management.ObjectQuery
Dim Ms As Management.ManagementScope
Dim Co As Management.ConnectionOptions
Dim Mo As Management.ManagementObject
Dim signalStrength As String
Try
Co = New Management.ConnectionOptions
Ms = New Management.ManagementScope("root\wmi")
Oq = New Management.ObjectQuery("SELECT * FROM
MSNdis_80211_ReceivedSignalStrength Where active=true")
query = New Management.ManagementObjectSearcher(Ms, Oq)
Qc = query.Get
signalStrength = 0

For Each Mo In query.Get

signalStrength = Mo("Ndis80211ReceivedSignalStrength")
ListBox2.Items.Add(signalStrength)
Next
Catch exp As Exception
' Indicate no signal
signalStrength = -1
End Try

----------------------------------------------------------------------------
I have tried to use the same code but replacing the signal strength
table with the others I have mentioned but it returns no results
(instances). Can anyone please explain why, and if there is a way
around this?

I am using Win XP SP2.

Thanks in advance,

Toby.
Aug 28 '08 #1
Share this Question
Share on Google+
3 Replies


P: n/a
"Toby Webb" wrote:
Hi, can anyone help please?

I am trying to get infromation from my wireless card, such as signal
strength and a list of SSIDs that it can see. I have been able to get
the signal strength (see code below), but I cannot get the list of
SSIDs. I have installed WMITools (from Microsoft) to delve in further
and it tells me that there is no instance for MSNdis_80211_WLanBssId
or MSNdis_80211_BSSIList.

The code I used to get the signal strength is below:

----------------------------------------------------------------------------

ListBox2.Items.Clear()
Dim query As Management.ManagementObjectSearcher
Dim Qc As Management.ManagementObjectCollection
Dim Oq As Management.ObjectQuery
Dim Ms As Management.ManagementScope
Dim Co As Management.ConnectionOptions
Dim Mo As Management.ManagementObject
Dim signalStrength As String
Try
Co = New Management.ConnectionOptions
Ms = New Management.ManagementScope("root\wmi")
Oq = New Management.ObjectQuery("SELECT * FROM
MSNdis_80211_ReceivedSignalStrength Where active=true")
query = New Management.ManagementObjectSearcher(Ms, Oq)
Qc = query.Get
signalStrength = 0

For Each Mo In query.Get

signalStrength = Mo("Ndis80211ReceivedSignalStrength")
ListBox2.Items.Add(signalStrength)
Next
Catch exp As Exception
' Indicate no signal
signalStrength = -1
End Try

----------------------------------------------------------------------------
I have tried to use the same code but replacing the signal strength
table with the others I have mentioned but it returns no results
(instances). Can anyone please explain why, and if there is a way
around this?

I am using Win XP SP2.

Thanks in advance,

Toby.
Developing on Win XP SP2, right? WMI = "Windows Mobile Interface"?

Anyway, we have Symbol Pocket PC devices here. They have WiFi cards in them,
but they are not managed by Windows. We can open the wireless settings, and
the Pocket PC OS does not show that the wireless is activated or even
available.

We had to go to the manufacturer.

Unfortunately, the Symbol company has been bought and sold many times, so
even the current manufacturer did not have an SDK that could address our
products.

Hopefully, you won't run into this.
Aug 29 '08 #2

P: n/a
On Aug 29, 9:51 pm, jp2msft <jp2m...@discussions.microsoft.comwrote:
"Toby Webb" wrote:
Hi, can anyone help please?
I am trying to get infromation from my wireless card, such as signal
strength and a list of SSIDs that it can see. I have been able to get
the signal strength (see code below), but I cannot get the list of
SSIDs. I have installed WMITools (from Microsoft) to delve in further
and it tells me that there is no instance for MSNdis_80211_WLanBssId
or MSNdis_80211_BSSIList.
The code I used to get the signal strength is below:
----------------------------------------------------------------------------
ListBox2.Items.Clear()
Dim query As Management.ManagementObjectSearcher
Dim Qc As Management.ManagementObjectCollection
Dim Oq As Management.ObjectQuery
Dim Ms As Management.ManagementScope
Dim Co As Management.ConnectionOptions
Dim Mo As Management.ManagementObject
Dim signalStrength As String
Try
Co = New Management.ConnectionOptions
Ms = New Management.ManagementScope("root\wmi")
Oq = New Management.ObjectQuery("SELECT * FROM
MSNdis_80211_ReceivedSignalStrength Where active=true")
query = New Management.ManagementObjectSearcher(Ms, Oq)
Qc = query.Get
signalStrength = 0
For Each Mo In query.Get
signalStrength = Mo("Ndis80211ReceivedSignalStrength")
ListBox2.Items.Add(signalStrength)
Next
Catch exp As Exception
' Indicate no signal
signalStrength = -1
End Try
----------------------------------------------------------------------------
I have tried to use the same code but replacing the signal strength
table with the others I have mentioned but it returns no results
(instances). Can anyone please explain why, and if there is a way
around this?
I am using Win XP SP2.
Thanks in advance,
Toby.

Developing on Win XP SP2, right? WMI = "Windows Mobile Interface"?

Anyway, we have Symbol Pocket PC devices here. They have WiFi cards in them,
but they are not managed by Windows. We can open the wireless settings, and
the Pocket PC OS does not show that the wireless is activated or even
available.

We had to go to the manufacturer.

Unfortunately, the Symbol company has been bought and sold many times, so
even the current manufacturer did not have an SDK that could address our
products.

Hopefully, you won't run into this.
It must be "Windows Management Instrumentation" to access low-level
hardware info provided by System.Management.dll. However, based on
OP's description, it would be wiser to catch the exception to
understand what kind of problem it would be, possibly it can be "not
supported" or anything else which is hardware dependant issue.

For example, including some modern multi-core PCs, when you query
"Win32_Fan" or "MSAcpi_ThermalZoneTemperature" in "root\WMI" scope you
get nothing or "not supported" error:
http://groups.google.com/group/micro...06b4a40cf31ea6

So, follow these to ensure if the query is really supported:
1)Start -Run
2)type "wbemtest"
3)Click on "Connect" and enter "root\WMI"
4)Click on "Query" and paste your query syntax.

See what output you'll get, again, it may not be related to your code.

Hope this helps,

Onur Güzel
Aug 29 '08 #3

P: n/a
On Aug 29, 8:42*pm, kimiraikkonen <kimiraikkone...@gmail.comwrote:
On Aug 29, 9:51 pm, jp2msft <jp2m...@discussions.microsoft.comwrote:


"Toby Webb" wrote:
Hi, can anyone help please?
I am trying to get infromation from my wireless card, such as signal
strength and a list of SSIDs that it can see. I have been able to get
the signal strength (see code below), but I cannot get the list of
SSIDs. I have installed WMITools (from Microsoft) to delve in further
and it tells me that there is no instance for MSNdis_80211_WLanBssId
or MSNdis_80211_BSSIList.
The code I used to get the signal strength is below:
---------------------------------------------------------------------------*-
ListBox2.Items.Clear()
* * * * Dim query As Management.ManagementObjectSearcher
* * * * Dim Qc As Management.ManagementObjectCollection
* * * * Dim Oq As Management.ObjectQuery
* * * * Dim Ms As Management.ManagementScope
* * * * Dim Co As Management.ConnectionOptions
* * * * Dim Mo As Management.ManagementObject
* * * * Dim signalStrength As String
* * * * Try
* * * * * * Co = New Management.ConnectionOptions
* * * * * * Ms = New Management.ManagementScope("root\wmi")
* * * * * * Oq = New Management.ObjectQuery("SELECT * FROM
MSNdis_80211_ReceivedSignalStrength Where active=true")
* * * * * * query = New Management.ManagementObjectSearcher(Ms, Oq)
* * * * * * Qc = query.Get
* * * * * * signalStrength = 0
* * * * * * For Each Mo In query.Get
* * * * * * * * signalStrength = Mo("Ndis80211ReceivedSignalStrength")
* * * * * * * * ListBox2.Items.Add(signalStrength)
* * * * * * Next
* * * * Catch exp As Exception
* * * * * * ' Indicate no signal
* * * * * * signalStrength = -1
* * * * End Try
---------------------------------------------------------------------------*-
I have tried to use the same code but replacing the signal strength
table with the others I have mentioned but it returns no results
(instances). Can anyone please explain why, and if there is a way
around this?
I am using Win XP SP2.
Thanks in advance,
Toby.
Developing on Win XP SP2, right? WMI = "Windows Mobile Interface"?
Anyway, we have Symbol Pocket PC devices here. They have WiFi cards in them,
but they are not managed by Windows. We can open the wireless settings,and
the Pocket PC OS does not show that the wireless is activated or even
available.
We had to go to the manufacturer.
Unfortunately, the Symbol company has been bought and sold many times, so
even the current manufacturer did not have an SDK that could address our
products.
Hopefully, you won't run into this.

It must be "Windows Management Instrumentation" to access low-level
hardware info provided by System.Management.dll. However, based on
OP's description, it would be wiser to catch the exception to
understand what kind of problem it would be, possibly it can be "not
supported" or anything else which is hardware dependant issue.

For example, including some modern multi-core PCs, when you query
"Win32_Fan" or "MSAcpi_ThermalZoneTemperature" in "root\WMI" scope you
get nothing or "not supported" error:http://groups.google.com/group/micro...languages.vb/b...

So, follow these to ensure if the query is really supported:
1)Start -Run
2)type "wbemtest"
3)Click on "Connect" and enter "root\WMI"
4)Click on "Query" and paste your query syntax.

See what output you'll get, again, it may not be related to your code.

Hope this helps,

Onur Güzel- Hide quoted text -

- Show quoted text -
Thanks for both of your help. I have found out that it is the wireless
card that doesn't support these methods (instead I have to use
Ather5000_ namespace instead of MSNDis).
Sep 1 '08 #4

This discussion thread is closed

Replies have been disabled for this discussion.