Skip to content

xScheduledTask: daily triggers fall out of compliance each day #148

@FinickyCode

Description

@FinickyCode

It seems that scheduled tasks with a daily schedule get deleted and recreated every day, on the first DSC run after midnight. It appears to me that the date in the daily trigger is compared to the current date.

You can reproduce this by creating a task with a daily trigger, then manually change the date in the daily trigger, and Test-DscConfiguration will return False, setting the date back to the current date will result in Test-DscConfiguration returning True.

Is this expected? Seems to me that the date on the daily trigger should not matter if it is the current date or earlier.

Configuration:

    xScheduledTask 'mytask'
    {
        Ensure                  = 'Present'
        TaskName                = 'mytask'
        Description             = 'Collect system information'
        ActionExecutable        = 'c:\windows\system32\WindowsPowerShell\v1.0\powershell.exe'
        ActionArguments         = '-NonInteractive -File c:\scripts\mytask.ps1 -output c:\temp\mytask\ -rsync -compress -verbose'
        ActionWorkingPath       = 'c:\scripts'
        ScheduleType            = 'Daily'
        DaysInterval            = 1
        StartTime               = '23:30:00'
        RandomDelay             = '01:00:00'
        ExecutionTimeLimit      = '06:00:00'
        Enable                  = $true
        MultipleInstances       = 'IgnoreNew'
        Priority                = 9
        Compatibility           = 'Win8'
    }

Windows version: Server 2016, 10.0.14393.0
PowerShell version:

>$PSVersionTable

Name                           Value
----                           -----
PSVersion                      5.1.14393.2068
PSEdition                      Desktop
PSCompatibleVersions           {1.0, 2.0, 3.0, 4.0, 5.0, 5.1.14393.2068}
BuildVersion                   10.0.14393.2068
CLRVersion                     4.0.30319.42000
WSManStackVersion              3.0
PSRemotingProtocolVersion      2.3
SerializationVersion           1.1.0.1

DSC module version: 4.0.0.0

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugThe issue is a bug.help wantedThe issue is up for grabs for anyone in the community.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions