Scheduled Task Trigger - Synchronize Across Time Zones09 Feb 2020 · Comments: 0 · Tags: WindowsTaskScheduler, ScheduledTask, DateTime, PowerShell
- Scheduled Task Settings
- ‘Synchronize Across Time Zones’ Explained
- Powershell’s New-ScheduledTaskTrigger cmdlet
When creating a scheduled task trigger using the Task Scheduler UI, the setting
Synchronize Across Time Zones is disabled by default. However, the PowerShell
New-ScheduledTaskTrigger exhibits the opposite behaviour.
I wanted to understand the purpose of this setting in order to determine whether I should enable or disable it, this post documents my findings.
Scheduled Task Settings
Behind the scenes, a scheduled task is stored as an XML file in
To signify that
Synchronize Across Time Zones is disabled, the time portion of
a trigger’s start time (referred to as the
StartBoundary) is recorded in the
XML file as
Thh:mm:ss. Whereas when enabled it’s recorded as
zero UTC offset.
‘Synchronize Across Time Zones’ Explained
Synchronize Across Time Zones is disabled, a trigger’s start date/time is
relative to the computer’s time zone. For example, if a trigger’s start date/time
is set to 10am on the 1st February 2020, the task will run once that date/time
has been reached according to the computer’s time zone.
Synchronize Across Time Zones is enabled, the specified date/time is
converted to its equivalent in Coordinated Universal Time (UTC).
For example, a start date/time of 10am on the 1st February 2020 on a computer
with a time zone of Central European Standard Time (UTC+1) would be 9am on the
1st February 2020 when converted to UTC.
Within the task’s XML file, the date/time is recorded in its UTC form as
The Task Scheduler UI always renders the time according to the computer’s time zone:
If the computer’s time zone is changed (something a user may do if travelling to a location in a different time zone) the task will continue to run according to the UTC time recorded in the task’s XML file.
- When converting the time to UTC, if the date/time supplied falls within daylight savings this is accommodated by regressing the time accordingly.
- Following a time zone change, you must close and reopen the Task Scheduler UI in order to see its effect.
Powershell’s New-ScheduledTaskTrigger cmdlet
As mentioned in the summary, the default behaviour of the Task Scheduler UI is
to create a trigger with
Synchronize Across Time Zones disabled, whereas
New-ScheduledTaskTrigger does the opposite.
Whether this matters or not depends on the use case. If the time zone of a
device never changes (excluding DST) then it effectively makes no difference
Synchronize Across Time Zones is enabled or disabled.
If I want to disable
Synchronize Across Time Zones, the workaround I use is to
New-ScheduledTaskTrigger with a dummy date/time and then overwrite the
StartBoundary property with the actual date/time I require, EG: