473,394 Members | 1,750 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,394 software developers and data experts.

Get network status through WMI

Hi all,

May i know how to get the network status through WMI, i have searched the
WMI properties but cannot find the related property to use.
thx in advance

Norton
Nov 20 '05 #1
3 4963
Hi,

If you are looking to check network status for an active network
connection. You need to a reference to system.management.dll for this to
work.

http://msdn.microsoft.com/library/de...connection.asp

Private Sub GetNetworkStatus()
Dim moReturn As Management.ManagementObjectCollection
Dim moSearch As Management.ManagementObjectSearcher
Dim mo As Management.ManagementObject

moSearch = New Management.ManagementObjectSearcher("Select * from
Win32_NetworkConnection")

moReturn = moSearch.Get
For Each mo In moReturn
Dim strOut As String
strOut = String.Format("{0} - Status {1}", mo("Name").ToString,
mo("Status").ToString)
Trace.WriteLine(strOut)
Next
End Sub

Here is a link to see if you are connected to a network that uses a
ping

http://msdn.microsoft.com/library/de...dunplugged.asp

Ken
--------------------------
"Norton" <no********@hotmail.com> wrote in message
news:%2***************@TK2MSFTNGP12.phx.gbl...
Hi all,

May i know how to get the network status through WMI, i have searched the
WMI properties but cannot find the related property to use.
thx in advance

Norton

Nov 20 '05 #2
thx a lot ~ it works ~

"Ken Tucker [MVP]" <vb***@bellsouth.net> ¦b¶l¥ó
news:Os**************@TK2MSFTNGP12.phx.gbl ¤¤¼¶¼g...
Hi,

If you are looking to check network status for an active network
connection. You need to a reference to system.management.dll for this to
work.

http://msdn.microsoft.com/library/de...connection.asp
Private Sub GetNetworkStatus()
Dim moReturn As Management.ManagementObjectCollection
Dim moSearch As Management.ManagementObjectSearcher
Dim mo As Management.ManagementObject

moSearch = New Management.ManagementObjectSearcher("Select * from
Win32_NetworkConnection")

moReturn = moSearch.Get
For Each mo In moReturn
Dim strOut As String
strOut = String.Format("{0} - Status {1}", mo("Name").ToString, mo("Status").ToString)
Trace.WriteLine(strOut)
Next
End Sub

Here is a link to see if you are connected to a network that uses a ping

http://msdn.microsoft.com/library/de...dunplugged.asp
Ken
--------------------------
"Norton" <no********@hotmail.com> wrote in message
news:%2***************@TK2MSFTNGP12.phx.gbl...
Hi all,

May i know how to get the network status through WMI, i have searched the WMI properties but cannot find the related property to use.
thx in advance

Norton


Nov 20 '05 #3
Hi I just tried this and I am propably missing something but I can't
get it to work. I belive that the problem is when moSearch.Get is
executed, in the debug output i get the following: "The thread '<No
Name>' (0xc88) has exited with code 0 (0x0)"

Thanks

Jacob

On Thu, 27 May 2004 06:53:40 -0400, "Ken Tucker [MVP]"
<vb***@bellsouth.net> wrote:
Hi,

If you are looking to check network status for an active network
connection. You need to a reference to system.management.dll for this to
work.

http://msdn.microsoft.com/library/de...connection.asp

Private Sub GetNetworkStatus()
Dim moReturn As Management.ManagementObjectCollection
Dim moSearch As Management.ManagementObjectSearcher
Dim mo As Management.ManagementObject

moSearch = New Management.ManagementObjectSearcher("Select * from
Win32_NetworkConnection")

moReturn = moSearch.Get
For Each mo In moReturn
Dim strOut As String
strOut = String.Format("{0} - Status {1}", mo("Name").ToString,
mo("Status").ToString)
Trace.WriteLine(strOut)
Next
End Sub

Here is a link to see if you are connected to a network that uses a
ping

http://msdn.microsoft.com/library/de...dunplugged.asp

Ken
--------------------------
"Norton" <no********@hotmail.com> wrote in message
news:%2***************@TK2MSFTNGP12.phx.gbl...
Hi all,

May i know how to get the network status through WMI, i have searched the
WMI properties but cannot find the related property to use.
thx in advance

Norton


Nov 20 '05 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
by: jack | last post by:
Hi, I am looking for a network analyzer like argus. If witten in python it would be easier to customize if need be. It should monitor the status of an ftp server (with each login password),...
1
by: ripken95 | last post by:
I connect to the internet through ADSL. I want to write the web page which can detect the connection status with javascript. This detection is like the signal detection in the mobile phone. If the...
5
by: Tony Wright | last post by:
Hi, I am having a problem installing an msi for a web site. The error message I am getting is: "The specified path 'http://mipdev05/features/Fas2' is unavailable. The Internet Information...
3
by: dotNetDave | last post by:
I just discovered that this: Dim searcher As New Management.ManagementObjectSearcher("SELECT NetConnectionStatus FROM Win32_NetworkAdapter") For Each networkAdapter As...
6
by: Christopher C | last post by:
I am currently working on an app the will be a shell replacement. Part of the goal is to list the current network status; basically I need to know if the network card is plugged in. I am currently...
5
by: Al | last post by:
Hi, Is there any way to detected if a device is connected? How would I query to see the device is connected to network. My application is mobile and mostly on wireless connection but it could be...
0
by: BLUE | last post by:
Enable and Disable in the Network and DialUp Connections manager is actually setting a bit in the registry for the target adapter and then calling NDIS to unbind or bind (depending on whether your...
2
by: =?Utf-8?B?Um9ja3k=?= | last post by:
If the network cable is unplugged I need to change an image on my main form status bar, however this does not work ' The computer has been connected or disconnected from the network If...
0
by: nancylife | last post by:
When developing web report, many developers use VMware to simulate different operating systems on a same server. Then, they can realize cross-platform deployment and debug of web report. According to...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
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...
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...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...

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.