473,698 Members | 2,005 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

System.Manageme nt query

Hi,

I'm trying to do asynchronous consumption of WMI events using System.Manageme nt.

Basically I want to monitor the connection status of Win32_NetworkAd apter. (i.e recieve events when it connects, disconnects)

I tried implementing and changing this code from msdn:

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

I changed it to use:

Dim query As New WqlEventQuery(" __InstanceModif icationEvent", "TargetInst ance ISA 'Win32_NetworkA dapter'")

The problem is that it demands I use a WITHIN in the WQL (otherwise I get a "HRESULT: 0x80042002" error).

I don't want to use WITHIN because this causes the system to poll and use quite a bit of CPU.

How come the example on MSDN doesn't need WITHIN?

What are my options here? Should I even use System.Manageme nt?

Thanks for any help you may have
--------------------------------
From: Justin M

-----------------------
Posted by a user from .NET 247 (http://www.dotnet247.com/)

<Id>JLYTmMk12U2 xwCkNkXpoTw==</Id>
Nov 20 '05 #1
0 1100

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

Similar topics

2
14040
by: Paul Gronka | last post by:
I've got a VB.NET windows application (written in VS .NET 2003) that makes a call to WMI for retrieving the MAC Address from the client's PC. It works on 4 out of the 5 PC's tested so far. All the workstations are DELLs running XP SP1a with the 1.1 .NET Framework. The following line of code generates an exception on the one PC: Dim oMac As New System.Management.ManagementClass("Win32_NetworkAdapterConfiguration") The error it...
0
1756
by: Ben Reese | last post by:
Kind people on this discussion group have previously helped me to dynamically identify CD rom drives etc at runtime using objects in System.management +++++++++++++++++++++++++++++++++++++++ Dim query As New System.Management.ManagementObjectSearcher("SELECT * From Win32_LogicalDisk") Dim queryCollection As System.Management.ManagementObjectCollection = query.Get() For Each mo As System.Management.ManagementObject In queryCollection
10
3248
by: Rada Chirkova | last post by:
Hi, at NC State University, my students and I are working on a project called "self-organizing databases," please see description below. I would like to use an open-source database system for implementation and would really appreciate your opinion on whether PostgreSQL is suitable for the project. In general, I am very impressed by the quality of PostgreSQL code and documentation, as well as by the support of the developer community. ...
0
3929
by: Scupper | last post by:
I am using the System.Management namespace for the first time and I cannot get the ManagementObject.SetPropertyValue method to work properly. I am trying to change the ServerName and ShareName of a printer, to facilitate changing the print server of workstations remotely in the event of a print server failure. Thanks in advance for any assistance.
0
2304
by: Gancy | last post by:
Hello, The code below enumerates all products installed on any given machine. Through System.Management i can also find WMI methods that could be exected. But i have not worked on WMI and System.Management before, i need to know how to execute the those mehtods ConnectionOptions options = new ConnectionOptions(); options.Authority = "NTLMDOMAIN:DOMAIN_X";
2
5488
by: Lamis | last post by:
Hi, I need urgent help, this is my code to rename my hostName: (MY computer is not member of domain) string compName = System.Windows.Forms.SystemInformation.ComputerName.ToString(); WqlObjectQuery query = new WqlObjectQuery("SELECT * FROM Win32_ComputerSystem"); ManagementObjectSearcher search = new ManagementObjectSearcher(query);
1
6310
by: ShrimpBoy | last post by:
Hi! I'm trying to erase SMS_Collection Rules using VB.NET 2003... I did that with WbemScripting, but now I need to do it with System.Management... My problem is that with System.Management I cannot get directly the item without enumerating a bunch of them (as I know)...
12
2397
by: not_a_commie | last post by:
Is using System.Management in general a faux pas? It seems, after some web searching, that there is a fair amount of resistance to it because of speed and portability. I need to know how many CPU sockets there are. I'm using System.Management to do this. It takes about two seconds to do this. (Which, yes, is full-on crap for speed.) But what is the better way to determine the number of CPU sockets in Windows version >= 5 with a .NET >=...
0
3693
by: =?Utf-8?B?am1hZ2FyYW0=?= | last post by:
I have a Windows service written in C# that is configured to automatically start. Sometimes - maybe 20% of the time - the service fails to start due to an exception in WMI code. I haven't made my service dependent on WMI (or any other service) because it appears that .net WMI calls automatically start the WMI service if necessary. Below are the details. What causes this? How can I make this code work 100% of the time? The code is trying to...
0
8671
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9016
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
8887
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 Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
8856
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 protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
5858
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
4360
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
1
3037
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
2321
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
1997
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.