If I have WMI query to get the status of something,is there an associated event that can listen for a change to that status. For example - i can query a motherboard serial number but is it possible to detect a change to the serial in the form of an event. Or at least I cannot find one. Using microsoft's wmi code creator there does not appear to be an event for a given query and i am wondering why not or am i wrong?.
Asked
Active
Viewed 272 times
0
-
You can use an [event query](http://msdn.microsoft.com/en-us/library/aa393013(v=vs.85).aspx) to monitor changes to WMI data. – stuartd Dec 29 '13 at 01:44
-
Hi, i know that but does every query have an event? – user1438082 Dec 29 '13 at 01:47
-
No, it doesn't work that way - you create an event query to watch specific WMI properties, and when the query fires you get the updated data from the returned values. – stuartd Dec 29 '13 at 01:51
-
Ok so taking my simple motherboard serial number can i write an event to listen for a change. I guess my question is general in that if i can query a value, can i detect a change using an event. I hope this makes sense – user1438082 Dec 29 '13 at 01:56
-
Yes, you'd query for a `__InstanceModificationEvent`, see http://stackoverflow.com/questions/17014765/wmi-instancemodificationevent-filtering for some example code, you'll just have to change the class and property names. However it might be tricky to change your motherboard serial number while the code is running, so if you are trying to implement some kind of copy-protection scheme then you will need to use another approach.. – stuartd Dec 29 '13 at 02:04