DSCResources/src/cWmiIntervalTimer.1.0.Resource.ps1

Write-DSCResource -Property @{
    TimerId = 'An identifier for the timer'
    IntervalBetweenEvents = 'The number of milliseconds between each event', [Uint64]
    SkipIfPassed = 'Indicates if the event should fire after the event has passed', [bool]
} -Test {
    $existingTimer = Get-WmiObject -Namespace root\cimv2 -Class __IntervalTimerInstruction -Filter "TimerID = '$TimerID'"

    $existingTimer -and 
        $existingTimer.IntervalBetweenEvents -eq $IntervalBetweenEvents -and 
        $existingTimer.TimerID -eq $TimerID -and
        $existingTimer.SkipIfPassed -eq $SkipIfPassed
} -Get {
    $existingTimer = Get-WmiObject -Namespace root\cimv2 -Class __IntervalTimerInstruction -Filter "TimerID = '$TimerID'"
    if (-not $existingTimer) { return @{} } 

    return @{
        TimerID = $existingTimer.TimerID
        SkipIfPassed = $existingTimer.SkipIfPassed
        IntervalBetweenEvents = $existingTimer.IntervalBetweenEvents
    }
} -Set {
    $wmiClass = [wmiclass]'__IntervalTimerInstruction'
    $newInstance = $wmiClass.CreateInstance()
    $newInstance.TimerID = $timerID
    $newInstance.IntervalBetweenEvents = $intervalBetweenEvents
    $newInstance.SkipIfPassed = $SkipIfPassed 
    $null = $newInstance.Put()    
} -KeyProperty TimerID -MandatoryProperty IntervalBetweenEvents