Learn how to a build a cloud-first strategyRegister Now

x
?
Solved

Scheduling remotet tasks

Posted on 2006-07-10
5
Medium Priority
?
298 Views
Last Modified: 2012-05-05
I support servers across the country and have a few processes that allow me
to execute tasks on all the servers using scheduled tasks. A script runs
through a server OU and creates a CMD file that looks like this....  (
simplified )

    at \\server1 4:00 d:\utils\process.cmd
    at \\server2 4:00 d:\utils\process.cmd
    at \\server3 4:00 d:\utils\process.cmd
    at \\server4 4:00 d:\utils\process.cmd
    ..
    ..

Executing this CMD file then schedules process.cmd to run on all servers at 4:00 AM.

There is one process in particular that I would like to have run at the same
time on all servers, but when the tasks are scheduled using the AT command
as seen above, the task runs on local time. Since my servers span the
country, several time zones are crossed.

Is there a way using AT or SCHTASKS that tasks can be scheduled to run at the same time (GMT) even though they cross time zones?

A simple "NO" answer gets you 50 points.
A "YES" and help to solve this will earn between 125 and 250 depending on the difficulty.



0
Comment
Question by:Sevy0622
  • 3
5 Comments
 
LVL 33

Expert Comment

by:NJComputerNetworks
ID: 17073661
no, I think you will have to script custom kick off times... You can either manually organize your servers into time zone and edit the script for the proper kick off time, or device a mechanism to check the system time zone before running the AT.
0
 
LVL 1

Accepted Solution

by:
cbeee earned 375 total points
ID: 17074222
you could use psexec within a batch file to run all the at commands at the same time.  psexec is a free tool which comes with other useful tools and is packaged as 'pstools'.
0
 

Author Comment

by:Sevy0622
ID: 17167895
Raising the point value for solution
0
 

Author Comment

by:Sevy0622
ID: 17167996
This worked with a little engineering.

Using psexec like
     psexec @DCList.txt \\rmtserver\rmtshare\script.cmd
will execute the script on all the servers, however, the process runs through the list of DCs in the text file, running the script against each server consecutively. This gets the script run on all servers, but when I have about 60 DCs in the list, and the process runs between 2-3 minutes on each server, that makes for a two to three hours time difference for the execution on the first and last servers.

...so...

I modified my script to create the CMD file....
     psexec \\server1 \\rmtserver\rmtshare\script.cmd
     psexec \\server2 \\rmtserver\rmtshare\script.cmd
     psexec \\server3 \\rmtserver\rmtshare\script.cmd
     ..

Thanks for your help!!!
     ..
So when I execute my CMD file, the script gets remotely launched on all DCs at the same time.

0
 

Author Comment

by:Sevy0622
ID: 17168034
FYI ...   Below is a script which I received to this question  from a news group. It uses a method where you determine the time zone offset for each server and adjust the execution time for the AT command. This is very interesting and something I will spend some time working with too.


    Save the following as sGMT.bat:

    @echo off
    if {%4}=={} @echo Syntax: Call sGMT \\Server GMT_Hour_2_Schedule GMT_Minute_2_Schedule 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

Then, in your batch

    call sGMT \\server1 4 0 d:\utils\process.cmd
    call sGMT \\server2 4 0 d:\utils\process.cmd
    call sGMT \\server3 4 0 d:\utils\process.cmd
    call sGMT \\server4 4 0 d:\utils\process.cmd

0

Featured Post

VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Restoring deleted objects in Active Directory has been a standard feature in Active Directory for many years, yet some admins may not know what is available.
This article provides a convenient collection of links to Microsoft provided Security Patches for operating systems that have reached their End of Life support cycle. Included operating systems covered by this article are Windows XP,  Windows Server…
This Micro Tutorial will teach you how to add a cinematic look to any film or video out there. There are very few simple steps that you will follow to do so. This will be demonstrated using Adobe Premiere Pro CS6.
Exchange organizations may use the Journaling Agent of the Transport Service to archive messages going through Exchange. However, if the Transport Service is integrated with some email content management application (such as an anti-spam), the admin…

810 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question