Downloads
41257.zip

I want to use the command line to back up data from a Windows 2000 system to a tape drive, as well as to restore the data from tape. How can I do so?

You can't use the command line to restore data from tape to a Win2K system, but both Windows XP and Win2K support several commands to perform backups. The following sample command runs a typical batch file, which you can use to back up the local system:

ntbackup backup C:  
  \[systemstate\]
  /J "<job name>"
  /D "<backup description>"  
  /HC:ON /T "<tape name>"
  /M incremental /um

The optional systemstate parameter is important. This parameter instructs NTBackup to back up the registry, the COM+ Class registration database, boot files (including system files), system files that are under Windows File Protection (WFP) and typically don't appear in Windows Explorer, and specialized data such as that contained in Active Directory (AD), Sysvol, and the Certificate Services database. This option is a marked improvement over NTBackup's /R switch (in Windows NT 4.0), which backs up only the registry. The /HC switch refers to hardware compression; I suggest you set this switch to ON (hardware compression permits faster backups that require less tape space). The /M switch refers to backup type; choose from normal, differential, incremental, or daily. The syntax in the example lets you run the batch file on multiple computers. The /um switch refers to unmanaged backup and tells NTBackup to format or overwrite the first tape that it finds.

Aside from the options that the example shows, you can replace the /T "tape name" switch with the /G "GUID" switch, which tells NTBackup to use a globally unique identifier (GUID) rather than a tape name. You can also use the /A switch in place of the /um switch to instruct NTBackup to append the backup rather than overwrite an earlier backup. You can add the /V:yes switch to verify the backup when it's finished. If more than one tape drive is present on a system, you can use the tape: parameter to specify which drive to use; tape:0 represents the first drive, tape:1 represents the second drive, and so on.

Unfortunately, NTBackup has some limitations, the most serious of which is its inability to back up remote computers' system state data. (That task requires the purchase of third-party software from a vendor such as VERITAS Software.) You can, however, back up a specific drive on a remote computer. To do so, list the computer name and drive—for example

ntbackup backup \\<computer name>\d$

—in the command. (The user running this command will need administrative privileges.) Alternatively, you can map a network drive at the command prompt, for example

net use x:
\\<computer name> \<sharename>

You can then use the /A switch to append the share backup to the tape, then type

net use x: /delete

to discontinue the retention of the share.

Listing 1 shows a batch file that you can use to back up a remote drive. When writing such a batch file, I prefer the command-line editor because it doesn't place any stray characters in the file. However, the DOS Copy con method still works in XP, and the F6 command still ends the file. Just be sure to use the .bat extension in the filename. For more information about the NTBackup command in Win2K, see the Microsoft article "How to Use Command Line Parameters With the 'Ntbackup' Command" (http://support.microsoft.com /?kbid=300439).