WinBatch Tech Support Home

Database Search

If you can't find the information using the categories below, post a question over in our WinBatch Tech Support Forum.

TechHome

Launching WinBatch and Other Apps
plus

Can't find the information you are looking for here? Then leave a message over on our WinBatch Tech Support Forum.

Running WinBatch Jobs on a Remote Workstation: An Overview

Keywords:  AT WINAT SCHEDULER REMOTE

Oftentimes the situation arises where one wishes to execute a WinBatch script on one or more remote workstations. For NT or 2000 based workstations it is actually fairly easy.

Assuming you have administrative access to the workstation and access to a shared folder someplace on the workstation you can use the AT command to run a job remotely.

Assuming that the 'AT' service is installed on the remote system, you simply copy a program to the remote system and the instruct the 'AT' service on the remote system to run that program at a certain time in the future. The program being run by the 'AT' service is subject to the usual limitations that apply when a program is being launched by a WinNT service, e.g. desktop may not be accessible, rights to network resources may be different than those of the user who submitted the job, etc...

The basic process is to:

Undebugged code:

masterexefile="c:\WBSCRIPTS\update.exe"  ; large model exe in this case
targetmachine="\\abc001"
targetfile="\\abc001\admin\update.exe"
remotename="c:\admin\update.exe"

now=TimeYmdHms()
now=TimeAdd(now,"0000:00:00:00:15:00")  ; add 15 min in case remote clock is off
hh=ItemExtract(4,now,":")
mm=ItemExtract(5,now,":")
time=strcat(hh,":",mm)

atcmd=strcat('/c AT ',targetmachine,' ',time,' /interactive "',remotename,'"')

FileCopy(masterexefile,remotename,0)
runwait("cmd.exe",atcmd)
Message(targetfile,"Submitted")

Instead of the AT command you can use the SOON command, so you don't have to worry about setting the exact time to schedule. (SOON is an NT command, a different version of the AT command.)

One way to troubleshoot a batch job that is scheduled to run using the AT command is to type the following at the MS-DOS command prompt:

   AT  /interactive cmd.exe /k 

       where  is the time in hours and minutes. 

Using the Windows NT Resource Kit utility Soon.exe, this command can be simplified even further to run within the next 5 seconds automatically:

       SOON /interactive cmd.exe /k 

Both of these commands open the MS-DOS command prompt at a scheduled time and allow you to manually run the batch job.

If an MS-DOS command prompt does not open, then launch the Control Panel Services applet and check to see if the Schedule service is started. Click the Startup button and make certain that the System account is selected; only the system account can interact with the desktop. Network connections made under the System account use a null session for credentials, so it may be necessary to supply a user name and password for commands such as NET USE.

Before running your batch job, type the command "SET" in order to understand the environment that the command scheduler is running under; all environmental variables including the user name will be listed.

MORE

The part of 'use SOON .. add a delay of 1 sec ..' is outdated. Only valid for pre IE 5.x. If you're using IE 5.x, the new scheduler needs times rounded to the next minute, otherwise the job will executed the next day. E.g. if it is 10:12:25, you have to schedule to 10:13, so SOON needs at least a delay of 35 secs.

Tech article Q237840 at microsoft explains this in detail....
http://support.microsoft.com/support/kb/articles/Q237/8/40.ASP



Article ID:   W14467
Filename:   Running Winbatch on a Remote Workstation.txt
File Created: 2012:10:03:11:30:34
Last Updated: 2012:10:03:11:30:34