473,382 Members | 1,766 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,382 software developers and data experts.

WMI to get SSID and signal strength information

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
3 13119
"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
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
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 thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
by: Dominik Kaspar | last post by:
hello i am writing a java program for locating a wireless device within an office environment. i want to use the signal strengths of the surrounding base stations (access points) to estimate the...
2
by: happymeteor | last post by:
Hi, everyone! I've tried to make a program which can get the wireless signal strength of wireless NIC(ex. 802.11b network card). As I know, regardless of whatever vender's NIC is used, in the...
13
by: steve | last post by:
is there an efficient way to detect wap signal strength/network connectivity w/o attempting a lan dependant operation and waiting for it to time-out? tia, steve
0
by: dogalmity | last post by:
None of the code segments I've seen on this will execute, they all give me an "invalid class" runtime error, either at the MoveNext() or the foreach. Do I need to somehow tell WMI which...
4
by: iKiLL | last post by:
Hi all I am working with CF2 and C#. I was hoping that someone could point me in the right direction for how I can determine if there is a GPRS Signal. I am using Merge Replication to SQL...
0
by: Nils Hulsch | last post by:
Hello, I'm want to get the SSID of the current wireless network. After some searching on the web, I've found a solution by querying the WMI, but it seems that its not working on Vista anymore. ...
6
by: Maarten Weyn | last post by:
Is there a way to get the signal strength of all surroundin access points in c# on a vista pc? regards Maarten Weyn
0
by: williambattersea | last post by:
Hello, I'm looking for a way to get wireless signal strength on Windows XP with Python. I see there's a library for Linux, but I can't find anything for windows. However, I see that using WMI I...
16
by: KDaly | last post by:
Hey guys, I was kind of hoping that someone could help me out with a project I am working on for school... We are desigining a robot that someone will approach, and the robot will ask the user if...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.