SUMMARY
You can perform backup operations from the command prompt or
from a batch file by using the
ntbackup backup command followed by various parameters. You can access only the
backup option from the command prompt. To restore files, use the Backup and
Restore Wizard.
This article describes the parameters available with
ntbackup and several examples of how to perform a backup from the command
line.
The
ntbackup command uses the following syntax:
ntbackup backup
[systemstate] "@FileName.bks" /J {"JobName"} [/P {"PoolName"}] [/G
{"GUIDName"}] [/T { "TapeName"}] [/N {"MediaName"}] [/F {"FileName"}] [/D
{"SetDescription"}] [/DS {"ServerName"}] [/IS {"ServerName"}] [/A] [/V:{yes |
no}] [/R:{yes | no}] [/L:{f | s | n}] [/M {BackupType}] [/RS:{yes | no}]
[/HC:{on | off}] [/SNAP:{on | off}]
back to the topNtbackup Parameters
Switch:
systemstateDescription: Specifies that you want to back up the System State data. When
you select this option, the backup type will be forced to normal or copy.
Switch:
@FileName.bks Description: Specifies the name of the backup selection file (.bks file) to
be used for this backup operation. The at (@) character must come before the
name of the backup selection file. A backup selection file contains information
about the files and folders you have selected for backup. You have to create
the file using the graphical user interface (GUI) version of Backup.
Switch:
/J {"JobName"} Description: Specifies the job name to be used in the backup report. The job
name generally describes the files and folders you are backing up in the
current backup job.
Switch:
/P {"PoolName"} Description: Specifies the media pool where you want to use media. This is
generally a subpool of the Backup media pool, such as 4mm DDS. If you select
this you cannot use the /A, /G, /F, or /T command-line options.
Switch:
/G {"GUIDName"} Description: Overwrites or appends to this tape. Do not use this switch in
conjunction with /P.
Switch:
/T {"TapeName"} Description: Overwrites or appends to this tape. Do not use this switch in
conjunction with /P.
Switch:
/N {"MediaName"} Description: Specifies the new tape name. You must not use /A with this
switch.
Switch:
/F {"FileName"} Description: Logical disk path and file name. You must not use the following
switches with this
Switch:
/P /G /TSwitch:
/D {"SetDescription"} Description: Specifies a label for each backup set.
Switch:
/DS {"ServerName"}Description: Backs up the directory service file for the specified Microsoft
Exchange server.
Exchange version: The /DS switch works only with Microsoft Exchange Server 5.5. The /DS switch does not work with Microsoft Exchange 2000 Server or Microsoft Exchange Server 2003.
Switch:
/IS {"ServerName"}Description: Backs up the Information Store file for the specified Microsoft
Exchange server.
Exchange version: The /IS switch works only with Microsoft Exchange Server 5.5. The /IS switch does not work with Microsoft Exchange 2000 Server or Microsoft Exchange Server 2003.
Switch:
/A Description: Performs an append operation. Either /G or /T must be used in
conjunction with this switch. Do not use this switch in conjunction with /P.
Switch:
/V:{yes | no} Description: Verifies the data after the backup is complete.
Switch:
/R:{yes | no} Description: Restricts access to this tape to the owner or members of the
Administrators group.
Switch:
/L:{f | s | n} Description: Specifies the type of log file: f=full, s=summary, n=none (no
log file is created).
Switch:
/M {BackupType} Description: Specifies the backup type. It must be one of the following:
normal, copy, differential, incremental, or daily.
Switch:
/RS:{yes | no} Description: Backs up the migrated data files located in Remote Storage. You
do not have to use the
/RS command-line option to back up the local Removable Storage
database (that contains the Remote Description: Storage placeholder files. When
you back up the %Systemroot% folder, Backup automatically backs up the
Removable Storage database also.
Switch:
/HC:{on | off} Description: Uses hardware compression, if available, on the tape drive.
Switch:
/SNAP:{on | off} Description: Specifies whether the backup must use a volume shadow copy.
Note The
SNAP switch is ignored in Microsoft Windows Server 2003 Service Pack 1 (SP1) and in later versions.
Switch:
/M {BackupType} Description: Specifies the backup type. It must be one of the following:
normal, copy, differential, incremental, or daily.
Switch:
/?Description: Displays help at the command prompt.
back to the topExamples
The following examples show how to use the
ntbackup command to back up files and folders from the command line or by
using a batch file. Note that if you do not specify an option, it applies the
settings that you set in the graphical version of the backup program.
Example 1
ntbackup backup \\iggy-multi\c$ /m normal /j "My Job 1" /p "Backup" /n "Command Line Backup 1" /d "Command Line Functionality" /v:yes /r:no /l:s /rs:no /hc:on
This example creates a normal backup of the remote share
\\iggy-multi\c$ and names it "My Job 1". It pulls a tape from the Backup media
pool, and names the tape "Command Line Backup 1." You can substitute
"
Command Line Functionality" in the command with the
actual description of your backup. This backup is verified after the backup job
is complete. Access is not restricted to the owner or the administrator, and
the logging level is set to "summary only." Remote Storage data is not backed
up, and hardware compression is enabled.
Example 2
ntbackup backup d:\ /j "My Job 2" /a /t "Command Line Backup 1" /m copy
This example generates a copy backup of the local drive D:\ and
names the backup "My Job 2". The backed up files and folders are added to the
tape that is named "Command Line Backup 1."
Example 3
ntbackup backup "@C:\Program Files\Windows NT\ntbackup\data\commandline.bks" /j "My Job 3" /t "Command Line Backup 1" /n "Command Line Backup 2"
This example generates the type of backup that you specified in
the graphical version of the Backup program. To specify the files that are
backed up, this example uses the "Commandline.bks" backup selection file
located in the C:\Program Files\Windows NT\Ntbackup\Data folder. The backup job
is named "My Job 3". It overwrites the tape that is named "Command Line Backup
1" with the new name "Command Line Backup 2."
Example 4
The following three commands perform a backup to a file from the
command line:
ntbackup backup \\iggy-multi\d$ /j "Command Line Backup 4" /f "D:\backup.bkf"
ntbackup backup \\iggy-multi\d$ /j "Command
Line Backup 5" /f "D:\backup.bkf" /a ntbackup
backup \\iggy-multi\d$ /j "Command Line Backup 6" /f
"D:\backup.bkf" The first example shows how to backup
\\iggy-multi\d$ to the file D:\Backup.bkf.
The second example shows how to
append the same backup to the same file.
The third example shows how to
overwrite the file with the same backup.
In all three examples, you can
substitute a complete UNC name for the drive letter. For example, instead of
d:\backup.bkf, you can use \\iggy-multi\d$\backup.bkf as the backup
destination.
All three examples use the Backup program's default values for
the backup type, verification setting, logging level, hardware compression, and
any other restrictions.
To start the graphical version of the Backup
program, click
Start, point to
All Programs,
point to
Accessories, point to
System Tools,
and then click
Backup.
back to the top