0

I have a question that I dont seem to be able to find an answer to. I am using WMI to create some timed events, and so far they are working well. The events repeat on the scheduled cycle as expected. I am now searching for a way to create a 'one-time' event that does not repeat and cant seem to figure it out or find an answer anywhere.

The following is an example from the MSDN website that creates a repeating event:

// Win32_LocalTime and Win32_UTCTime reside in root\cimv2 namespace. 
// Defining the EventNamespace allows the filter
// to be compiled in any namespace.
instance of __EventFilter as $FILT1
{
    Name  = "wake-up call";
    Query = "SELECT * FROM __InstanceModificationEvent WHERE "    
    "TargetInstance ISA \"Win32_LocalTime\" AND "
    "TargetInstance.Hour = 0 AND TargetInstance.Minute = 0 AND "
 "TargetInstance.Second = 0";
    QueryLanguage = "WQL";
    EventNamespace = "root\\cimv2";
};

What I would like is to make it non-repeating. Any ideas?

Cheers

The Frog

The Frog
  • 85
  • 7

1 Answers1

0

The __InstanceModificationEvent class is a intrinsic event which reports when a change was made to a instance of a WMI class, in this case is listening the Win32_LocalTime WMI class which return the current time. Now if you want create a non repeating event you can add the the year , month and day properties to the WQL sentece.

instance of __EventFilter as $FILT1
{
    Name  = "wake-up call";
    Query = "SELECT * FROM __InstanceModificationEvent WHERE "    
    "TargetInstance ISA \"Win32_LocalTime\" AND "
    "TargetInstance.Hour = 0 AND TargetInstance.Minute = 0 AND TargetInstance.Second = 0 AND "
    "TargetInstance.Year=2012 AND TargetInstance.Month=7 AND TargetInstance.Day=12";
    QueryLanguage = "WQL";
    EventNamespace = "root\\cimv2";
};
RRUZ
  • 134,889
  • 20
  • 356
  • 483
  • Thankyou for clarifying that for me. Do you know if this is the same for registering a permanent event? Can a permanent event be consumed even after a machine restart? If the event passes while the machine is powered off will there still be a notification? – The Frog Jul 13 '12 at 13:55
  • Q : Do you know if this is the same for registering a permanent event? A : Yes – RRUZ Jul 13 '12 at 15:22
  • Q : same for registering a permanent event? Can a permanent event be consumed even after a machine restart? A : Yes, that is one of the differences between a temporary and permenent event. – RRUZ Jul 13 '12 at 15:23
  • Q : If the event passes while the machine is powered off will there still be a notification? A: I don't think so because in this case the event is monitoring a particular set of conditions and the WMI is not aware which that conditions are related to datetime factors. So if the conditions doesn't match the event will not be fired. – RRUZ Jul 13 '12 at 15:26
  • Thankyou for answering these questions. I appreciate the guidence. I can now move forwardf with my project. Thankyou very much. – The Frog Jul 15 '12 at 04:35