Solved

Scheduling remotet tasks

Posted on 2006-07-10
5
294 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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 125 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

Ransomware: The New Cyber Threat & How to Stop It

This infographic explains ransomware, type of malware that blocks access to your files or your systems and holds them hostage until a ransom is paid. It also examines the different types of ransomware and explains what you can do to thwart this sinister online threat.  

Question has a verified solution.

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

Scenerio: You have a server running Server 2003 and have applied a retail pack of Terminal Server Licenses.  You want to change servers or your server has crashed and you need to reapply the Terminal Server Licenses. When you enter the 16-digit lic…
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 video Micro Tutorial shows how to password-protect PDF files with free software. Many software products can do this, such as Adobe Acrobat (but not Adobe Reader), Nuance PaperPort, and Nuance Power PDF, but they are not free products. This vide…
Michael from AdRem Software outlines event notifications and Automatic Corrective Actions in network monitoring. Automatic Corrective Actions are scripts, which can automatically run upon discovery of a certain undesirable condition in your network.…

690 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