JSI Tip 4113. Windows XP backup command-line switches.

Jerold Schulman

September 16, 2001

6 Min Read
ITPro Today logo in a gray background | ITPro Today

I documented and used Windows 2000 NTBackup command-line switches in the following tips:

2148 Windows 2000 NTBackup command line switches.

2265 How do I perform an NTBackup in Windows 2000, without having to manually manage the media?

The Windows XP NTBackup.exe help file contains:

Ntbackup

Perform backup operations at a command prompt or from a batch file using the ntbackup command followed by various parameters.

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}]

Parameters

systemstate 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. @FileName.bks Specifies the name of the backup selection file (.bks file) to be used for this backup operation. The at (@) character must precede the name of the backup selection file. A backup selection file contains information on the files and folders you have selected for backup. You have to create the file using the graphical user interface (GUI) version of Backup. /J {"JobName"} Specifies the job name to be used in the backup report. The job name usually describes the files and folders you are backing up in the current backup job. /P {"PoolName"} Specifies the media pool from which you want to use media. This is usually 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. /G {"GUIDName"} Overwrites or appends to this tape. Do not use this switch in conjunction with /P. /T {"TapeName"} Overwrites or appends to this tape. Do not use this switch in conjunction with /P. /N {"MediaName"} Specifies the new tape name. You must not use /A with this switch. /F {"FileName"} Logical disk path and file name. You must not use the following switches with this switch: /P /G /T. /D {"SetDescription"} Specifies a label for each backup set. /DS {"ServerName"} Backs up the directory service file for the specified Microsoft Exchange Server. /IS {"ServerName"} Backs up the Information Store file for the specified Microsoft Exchange Server. /A 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. /V:{yes | no} Verifies the data after the backup is complete. /R:{yes | no} Restricts access to this tape to the owner or members of the Administrators group. /L:{f | s | n} Specifies the type of log file: f=full, s=summary, n=none (no log file is created). /M {BackupType} Specifies the backup type. It must be one of the following: normal, copy, differential, incremental, or daily. /RS:{yes | no} Backs up the migrated data files located in Remote Storage. The /RS command-line option is not required to back up the local Removable Storage database (that contains the Remote Storage placeholder files). When you backup the %systemroot% folder, Backup automatically backs up the Removable Storage database as well. /HC:{on | off} Uses hardware compression, if available, on the tape drive. /SNAP:{on | off} Specifies whether or not the backup should use a volume shadow copy. /M {BackupType} Specifies the backup type. It must be one of the following: normal, copy, differential, incremental, or daily. /? Displays help at the command prompt.

Remarks

  • You cannot restore files from the command line using the ntbackup command.

  • The following command-line options default to what you have already set using the graphical user interface (GUI) version of Backup unless they are changed by a command-line option: /V /R /L /M /RS /HC. For example, if hardware compression is turned on in the Options dialog box in Backup, it will be used if /HC is not specified on the command line. However, if you specify /HC:off at the command line, it overrides the Option dialog box setting and compression is not used.

  • If you have Windows Media Services running on your computer, and you want to back up the files associated with these services, see "Running Backup with Windows Media Services" in the Windows Media Services online documentation. You must follow the procedures outlined in the Windows Media Services online documentation before you can back up or restore files associated with Windows Media Services.

  • You can only back up the System State data on a local computer. You cannot back up the System State data on a remote computer

  • If you are using Removable Storage to manage media, or you are using the Remote Storage to store data, then you should regularly back up the files that are in the following folders:

    SystemrootSystem32Ntmsdata

    SystemrootSystem32Remotestorage

    This ensures that all Removable Storage and Remote Storage data can be restored.

Examples

Following are four examples of how you can use the ntbackup command.

To perform a normal backup

The following example performs a normal backup named "My Job 1" of the remote share \iggy-multic$. This example pulls a tape from the Backup media pool, and name the tape "Command Line Backup 1." The description of the backup job is "Command Line Functionality." The backup is verified after the backup job is complete, access is not restricted to the owner/administrator, the logging level is setto summary only, Remote Storage data is not backed up, and hardware compression is enabled.

ntbackup backup \iggy-multic$ /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

To perform a copy backup

The following example performs a copy backup named "My Job 2" of the local drive D:. The backed up files and folders are appended to the tape named "Command Line Backup 1." All other options default to those specified in the Backup program.

ntbackup backup d: /j "My Job 2" /a /t "Command Line Backup 1" /m copy

To perform a backup using the backup type specified in Backup

The following example performs a backup using the backup type that is specified in the Backup program. It uses the backup selection file named Commandline.bks, located in the C:Program FilesWindows NTtbackupdata directory to choose which files to backup. The backup job is named "My Job 3" and it overwrites the tape named "Command Line Backup 1" with the new name "Command Line Backup 2."

ntbackup backup "@C:Program FilesWindows NTtbackupdatacommandline.bks" /j "My Job 3" /t "Command Line Backup 1" /n "Command Line Backup 2"

To perform a backup to a file from the command line

The following examples show how to perform a backup to a file from the command line. All three examples use the Backup program's default values for the backup type, verification setting, logging level, hardware compression, and any other restrictions. The first example shows how to backup \iggy-multid$ to thefile 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 a complete UNC name could be substituted for the drive letter (that is, instead of d:backup.bkf, the user could specify \iggy-multid$backup.bkf as the backup destination).

ntbackup backup \iggy-multid$ /j "Command Line Backup 4" /f "D:backup.bkf"

ntbackup backup \iggy-multid$ /j "Command Line Backup 5" /f "D:backup.bkf" /a

ntbackup backup \iggy-multid$ /j "Command Line Backup 6" /f "D:backup.bkf"



Sign up for the ITPro Today newsletter
Stay on top of the IT universe with commentary, news analysis, how-to's, and tips delivered to your inbox daily.

You May Also Like