__IntervalTimerInstruction

Interval Timer Instruction
rootkey : TimerId

Generates events at intervals, similar to a WM_TIMER message in Windows programming.

On this page

Main example

List instances

# All instances of __IntervalTimerInstruction, with the main properties
Get-CimInstance -ClassName __IntervalTimerInstruction -Namespace 'root' |
    Select-Object -Property TimerId, IntervalBetweenEvents, SkipIfPassed

Examples

Filter with WQL

# WQL filter evaluated by the provider: only the instances where SkipIfPassed is TRUE
$cimParameters = @{
    ClassName = '__IntervalTimerInstruction'
    Namespace = 'root'
    Filter    = 'SkipIfPassed = TRUE'
}
Get-CimInstance @cimParameters |
    Select-Object -Property TimerId, IntervalBetweenEvents, SkipIfPassed

The filter is evaluated by the WMI provider: less data is transferred than with Where-Object.

Query a remote computer (CIM session)

review before running
# Name of the remote computer
$computerName = 'SERVER01'
# The CIM session (WSMan by default) can be reused for several queries
$cimSession = New-CimSession -ComputerName $computerName
try {
    $cimParameters = @{
        CimSession = $cimSession
        ClassName  = '__IntervalTimerInstruction'
        Namespace  = 'root'
    }
    Get-CimInstance @cimParameters |
        Select-Object -Property TimerId, IntervalBetweenEvents, SkipIfPassed
} finally {
    Remove-CimSession -CimSession $cimSession
}

WSMan (WinRM) is used by default. For a host without WinRM, create the session with -SessionOption (New-CimSessionOption -Protocol Dcom). Add -Credential to use another account.

Show the class structure

# Class structure: properties, types and flags (Key, ReadOnly…)
$cimClass = Get-CimClass -ClassName __IntervalTimerInstruction -Namespace 'root'
$cimClass.CimClassProperties |
    Select-Object -Property Name, CimType, Flags

Properties

3 of 3 properties
NameTypeAccessDescription
IntervalBetweenEventsuint32read

Number of milliseconds between event firings.

Code
# Value of IntervalBetweenEvents for each instance
$cimParameters = @{
    ClassName = '__IntervalTimerInstruction'
    Namespace = 'root'
    Property  = @('TimerId', 'IntervalBetweenEvents')
}
Get-CimInstance @cimParameters |
    Select-Object -Property TimerId, IntervalBetweenEvents
SkipIfPassedbooleanread

If TRUE, this event is to be skipped if the interval is already passed. The default is FALSE. This property is inherited from __TimerInstruction.

FALSE

When WMI or the consumer becomes available again, a notification event will be generated and received.

TRUE

The timer event does not occur if WMI is unavailable to generate it at the appropriate time interval, or the consumer requesting to receive the event is unavailable.

Code
# Value of SkipIfPassed for each instance
$cimParameters = @{
    ClassName = '__IntervalTimerInstruction'
    Namespace = 'root'
    Property  = @('TimerId', 'SkipIfPassed')
}
Get-CimInstance @cimParameters |
    Select-Object -Property TimerId, SkipIfPassed
TimerId keystringread

Unique identifier for this __IntervalTimerInstruction object. This property is inherited from __TimerInstruction.

Code
# Value of TimerId for each instance
$cimParameters = @{
    ClassName = '__IntervalTimerInstruction'
    Namespace = 'root'
    Property  = 'TimerId'
}
Get-CimInstance @cimParameters |
    Select-Object -Property TimerId

Remarks

The __IntervalTimerInstruction class is derived from __TimerInstruction.

The event query entered to register for an interval timer event is usually based on the TimerId property. Notification events generated from an interval timer event contain the property NumFirings which contains data reflecting how many events fired during the time the events were unable to be received. If SkipIfPassed is set to TRUE, that information is discarded.

The value for the IntervalBetweenEvents property should be reasonably large. If it is too small, WMI may ignore it and not generate the event due to limitations in some operating systems.

WMI generates the interval timer event by creating an instance of the __TimerEvent class.

To receive these timer events in a temporary event consumer, execute IWbemServices::ExecNotificationQuery with the following event query string:

```sql

SELECT * FROM __TimerEvent WHERE TimerID = "MyEvent"

```

To receive these timer events in a permanent event consumer, you must load the previous query into an event filter, define a logical consumer, and create a filter-to-consumer binding for the filter and consumer. For more information, see Receiving Events at All Times.

Inheritance

Superclass chain

  1. __SystemClass
  2. __IndicationRelated
  3. __EventGenerator
  4. __TimerInstruction
  5. __IntervalTimerInstruction

Known subclasses

No known subclass.

Requirements

Namespace
root
Minimum client
Windows Vista
Minimum server
Windows Server 2008
DLL
All

Microsoft source

Source: Microsoft Learn

Descriptions, properties and methods come from the Microsoft documentation (MicrosoftDocs/win32 repository), published under the CC BY 4.0 licence. Formatting and translations are specific to this site; the PowerShell examples are written for it.