Permanent Event Subscription
All the event notifications described in the preceding section are examples of temporary event subscription. A script connects to WMI, registers (a.k.a. subscribes) to receive notification of a specified set of events and, provided that the script continues to run and notification is not explicitly cancelled, events will continue to be delivered each time they occur. As soon as a script quits, however, notification ceases. Likewise, unless a script is explicitly started, no events will ever be delivered. In short, the event delivery is temporary.
In many circumstances, this behavior is absolutely fine. If you need to ensure that particular types of events never go unnoticed, just make sure that the script written ...
Get Windows Management Instrumentation (WMI) now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.