Schedule the Script
After you create a backup script for automated network backup, test the
script commands by entering them one line at a time at the command prompt. If
the commands execute as planned, run the entire script from the command prompt
by entering the script name. If the script works as intended, you're ready to
schedule it to run automatically using either the Command Scheduler (WINAT.EXE)
included with the Microsoft NT Resource Kit or the AT command (AT.EXE).
The Command Scheduler is a graphical interface for the AT command. Although the
AT command isn't as elegant, if you don't have the resource kit, you can use it
to fulfill all your scheduling needs. In either case, by default, only
Administrators can submit commands with these utilities.
To use either the Command Scheduler or the AT command, start the Scheduler
service from Control Panel, Services. You need Administrator privileges to start
this service. Note, however, that AT jobs don't run under the security context
of the user requesting the job. Rather, they use the security context of the
Schedule service, which is typically in the context of the operating system.
Make sure you set the startup mode to Automatic so your scheduled jobs will
survive a reboot.
Let's look at how to schedule a command to run via the Command Scheduler
and via the AT command. The NT resource kit (highly recommended for any
NT-phile) includes the Command Scheduler in the Configuration menu. Once you
start this program, the program asks you whether you want to start the Scheduler
service, if it isn't already started. Answer yes, and then select Edit, Add to
schedule your new script. You'll see a window similar to Screen 1. Enter your
script filename (use the full path if the script isn't in a directory listed in
the path variable) and the parameters describing when you want it to run. Check
the Interactive box only if you want to require a user to enter information
during the script execution. After you click OK, you see the Command Scheduler
window, shown in Screen 2, which lists AT jobs, including your script file with
the appropriate times. If an error appears in the Error column after the time
scheduled for your AT job to execute, make sure you've placed the script file in
a directory listed in the path, or provide the full path to the script file.
When you're sure the scheduling information is correct, simply close the Command
Scheduler, and your script file is ready to go.
If you don't have the Resource Kit, you can use the AT command to schedule
the backup script. First, enter
AT/?
at the command prompt to learn more about the AT command's switches and
arguments. Then, at the command line enter a line similar to
AT \\<MachineName> 1:00 /EVERY:Saturday "backup.bat"
This command schedules the script file for the same settings you used for
the Command Scheduler.
Restoring Data
Although the backup script automates network backup, it performs no restore
functions. To restore data from tape, you use the NTBACKUP program's restore
function. To perform a restore, select the Tapes option from the Windows menu
and double-click the tape icon to display the backup set list on the tape. From
the set list, you can select entire drives, directories, or individual files for
restoration, by clicking the boxes preceding their names. Click Restore. On the
window you see in Screen 3, designate where you want to place the restored
files, if not in the original location. If you intend to restore the files to
their initial location, make sure you have re-established the original network
connections.
Restoring drives containing NT system files requires more work. If the
drive you want to restore was local to the system that created the backup and
you used the /b option to back up that system's Registry to the tape, you're in
luck. Place the backup tape drive on an NT system that has access to the drive
you want to restore. If this system is another machine, you physically move the
hard drive from this machine back to the original machine after you have
restored NT. You can also use another installation of NT on your system if the
second version of NT is on a different hard drive. Find the disk in the tape's
backup set list, select the entire drive, and click Restore. Next, check the
Restore Local Registry box, and click OK. After the program has restored files
to disk, you have to return the drive to the exact hardware configuration it was
in when it last successfully ran NT. You might have to remove the tape device
from your other system and add it back to your original machine. The system
startup files expect the same environment that existed when you made the backup.
If the drive you want to restore contains an NT system and was a remote
drive, you need an ERD to successfully return the system to its previous state
(you should have already made a repair disk before backing up the system). To
restore this drive, select the entire disk from the backup set list and restore
it to a replacement drive. Install the replacement drive in the NT machine and
begin the NT installation. Choose to repair an installation when prompted, and
insert the ERD. Select Inspect Registry Files, and continue. The program
presents you with a list of Registry keys that the system can restore; select
all of them. When the program has successfully restored the Registry, reboot
your system.
Missing Features
Although writing a script and using the AT command or Command Scheduler is a
flexible solution, the solution lacks some features that you might find in a
commercial NT network backup product. The most obvious shortcoming is the
inability to back up Registries on remote drives. However, as I've already
mentioned, you can address this limitation by creating an ERD for each machine
you back up.
Another pitfall is that all shares you back up must fit on one tape;
otherwise you must manually change tapes, which defeats the purpose of an
unattended backup. In this situation or others that require user input, you must
run the script in Interactive mode or the NT
BACKUP process will hang, and
you'll have to reboot and restart the script.
But don't worry. If the script tries to connect to a share on a machine
that's turned off or otherwise debilitated, the script will skip this command
and move to the next one and back up other shares.
Want More?
You can find more information In the NT backup program's Help file. Look
under the Backup disk files to tape book and then under Using batch
files to do backups. Or enter
NTBACKUP/?
at the command prompt to list the command-line switches for the NTBACKUP
command. To obtain more information about connecting and disconnecting network
shares, enter
NETHELPUSE
at the command prompt.
The NT Resource Kit includes commands that let a script pause in its
execution or pause for user input (see SLEEP /? and TIMEOUT /?, respectively).
In addition to command-line Help, you can find more information about the
commands in this article in the resource kit documentation. For more information
on backing up your system, see Bob Chronister, "System and Enterprise-wide
Backup Software," April 1996.