Q. How can I schedule a job to run locally or remotely at a specified GMT time, regardless of Time Zone?

Jerold Schulman

July 13, 2006

1 Min Read
ITPro Today logo

Using REG.EXE, built into Windows XP, Windows Server 2003, and later operating systems, or installed from the Windows 2000 Support Tools, I have scripted sGMT.bat to schedule a task based upon GMT (Greenwich Mean Time), regardless of the Time Zone.

The syntax for using sGMT.bat is:

Call sGMT \Computer GMT_Hour2Schedule GMT_Minute2Schedule FQFN


\Computer          is the computer that the task is scheduled to run on.GMT_Hour2Schedule   is GMT hour the job should be scheduled to run.GMT_Minute2Schedule is the GMT minute of GMT_Hour2Schedule the job should be scheduled to run.FQFN                is the Fully Qualified File Name of the job or command.


If you want c:utiljob.bat to run on \Server1 at 0:30 GMT:

call sGMT \Server1 0 30 c:utiljob.bat

If \Server1 is in the US Eastern Standard Time zone and daylight savings is enabled, then the job would be scheduled to run at 04:30.

sGMT.bat contains:

 @echo offif {%4}=={} @echo Syntax: Call sGMT \Computer GMT_Hour2Schedule GMT_Minute2Schedule FQFN&goto :EOFsetlocalset key=%1HKLMSystemCurrentControlSetControlTimeZoneInformationfor /f "Tokens=3" %%a in ('reg query %key% /V ActiveTimeBias^|FIND "REG_DWORD"') do (    set /a off=%%a)if %off% GEQ 0 goto posset /a off=0 - %off%set /a oh=%off% / 60set /a om=%off% - (%oh% * 60)set /a oh=24 - %oh%set /a sh=%2 + %oh%set /a sm=%3 + %om%if %om% NEQ 0 set /a sh=%sh% - 1goto :OK:posset /a oh=%off% / 60set /a om=%off% - (%oh% * 60)set /a sh=%2 + %oh%set /a sm=%3 + %om%:OKif %sm% LSS 10 set sm=0%sm%AT %1 %sh%:%sm% %4

Sign up for the ITPro Today newsletter
Stay on top of the IT universe with commentary, news analysis, how-to's, and tips delivered to your inbox daily.

You May Also Like