Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

xScheduledTask: Trigger has no option for Synchronize across time zones #109

Closed
StefanSchoof opened this issue Oct 30, 2017 · 8 comments · Fixed by #185
Closed

xScheduledTask: Trigger has no option for Synchronize across time zones #109

StefanSchoof opened this issue Oct 30, 2017 · 8 comments · Fixed by #185
Labels
bug The issue is a bug.

Comments

@StefanSchoof
Copy link

Details of the scenario you tried and the problem that is occurring:
I have some Scheduled Task set up with xScheduledTask in the Daylight Saving Time on a Windows Server 2016. After End of the DST my Jobs run one hour early. But one hour early the other system was not ready. After removing the "Synchronize across time zones" in the schedule, the start time is the current time (Local Non DST).

I found no option to change the "Synchronize across time zones" this with xScheduledTask.

@PlagueHO
Copy link
Member

Hi @StefanSchoof - are you able to tell me which version of xComputerManagement you're using? There was a fix in v3.0.0.0 that hopefully addressed this.

@StefanSchoof
Copy link
Author

Currently I have 3.0.0.0. I do not remember updating the module since I set up my task, but It is possible I did.

@PlagueHO
Copy link
Member

Are you able to take a look at the MOF file that was used to apply to the node to see if it used 3.0.0.0? If it is using 3.0.0.0 and the problem still exists then there may still be an issue with daylight savings time.

@StefanSchoof
Copy link
Author

I search my log and found that the Install-Module run on the 06. October 2017 and the first apply failed because I used the old syntax. I had a RepeatInterval = 1 which I removed. So I think I used 3.0.0.0 the whole time on this Server.

@PlagueHO PlagueHO added bug The issue is a bug. help wanted The issue is up for grabs for anyone in the community. labels Oct 30, 2017
@PlagueHO
Copy link
Member

This must still be an issue then. But you are right, it doesn't look like the Synchronize across time zones is exposed in the resource. I couldn't actually find this in the New-ScheduledTaskTrigger cmdlet either - so I'll need to do some more digging to see where/how this gets exposed to PowerShell.

@StefanSchoof
Copy link
Author

Here a the steps for a repo:

  1. Create a Windows 2016 VM in Azure
  2. Deactivate the Hyper-V Time Synchronization Service
  3. Change Time Settings: Settings -> Time & language -> Set time automatically: Off, Time zone UTC + 01:00 Amsterdam, ..., Change Date to 27 October (Had DST Change on 29. October)
  4. Add a dsc file
configuration ScheduledTask
{
    param
    (
        [string[]]$NodeName = 'localhost'
    )

    Import-DSCResource -ModuleName xComputerManagement

    Node $NodeName
    {
        xScheduledTask Test
        {
            TaskName = "Test"
            ActionExecutable = "cmd"
            ScheduleType = "Daily"
            StartTime = "05:00:00 AM"
        }
    }
}
  1. Install-Module xComputerManagement
    . .\dsc.ps1
    ScheduledTask
    Start-DscConfiguration -Path .\ScheduledTask\ -Wait -Verbose

  2. Take a look at the Task Scheduler
    task1
    Next run time is at 5 AM

  3. Change Time Back to 30. October

  4. Take a lock again at the Task Scheduler
    task2
    Next run time is at 4 AM

@johlju johlju removed the help wanted The issue is up for grabs for anyone in the community. label Oct 2, 2018
@hassan041
Copy link

hassan041 commented Jan 17, 2020

Use Z at the end of time . it enables the option.
2018-06-14T19:00:00Z

Z at the end of the time does 2 things.

  1. The time entries would be considered in UTC mode and it automatically converts to Local time in the server when the task is created.
  2. it also enable option "Synchronize across time zones", which will take of any changes like daylight saving of the time zone

@PlagueHO
Copy link
Member

Thanks @hassan041 - it is possible we'll be able to improve this code in the future.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug The issue is a bug.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants