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
Where:
\\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.
Examples:
If you want c:\util\job.bat to run on \\Server1 at 0:30 GMT:call sGMT \\Server1 0 30 c:\util\job.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 off if \{%4\}==\{\} @echo Syntax: Call sGMT \\Computer GMT_Hour2Schedule GMT_Minute2Schedule FQFN&goto :EOF setlocal set key=%1\HKLM\System\CurrentControlSet\Control\TimeZoneInformation for /f "Tokens=3" %%a in ('reg query %key% /V ActiveTimeBias^|FIND "REG_DWORD"') do ( set /a off=%%a ) if %off% GEQ 0 goto pos set /a off=0 - %off% set /a oh=%off% / 60 set /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% - 1 goto :OK :pos set /a oh=%off% / 60 set /a om=%off% - (%oh% * 60) set /a sh=%2 + %oh% set /a sm=%3 + %om% :OK if %sm% LSS 10 set sm=0%sm% AT %1 %sh%:%sm% %4
0 comments
Hide comments