Solved

Scheduling remotet tasks

Posted on 2006-07-10
5
284 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
Comment Utility
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
Comment Utility
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
Comment Utility
Raising the point value for solution
0
 

Author Comment

by:Sevy0622
Comment Utility
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
Comment Utility
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

IT, Stop Being Called Into Every Meeting

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

Join & Write a Comment

Suggested Solutions

Title # Comments Views Activity
Screen Mirroring 7 37
Group Policy & Netlogin Services 5 30
Auslogics BoostSpeed 9 software 5 42
Computer software inventory 5 33
Organizations create, modify, and maintain huge amounts of data to help their businesses earn money and generally function.  Typically every network user within an organization has a bit of disk space to store in process items and personal files.   …
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…
Illustrator's Shape Builder tool will let you combine shapes visually and interactively. This video shows the Mac version, but the tool works the same way in Windows. To follow along with this video, you can draw your own shapes or download the file…
This video gives you a great overview about bandwidth monitoring with SNMP and WMI with our network monitoring solution PRTG Network Monitor (https://www.paessler.com/prtg). If you're looking for how to monitor bandwidth using netflow or packet s…

763 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

Need Help in Real-Time?

Connect with top rated Experts

13 Experts available now in Live!

Get 1:1 Help Now