NTBACKUP - CMD


Overview

NTBACKUP is the command-line version of the backup utility available in Windows XP and Windows Server 2003. It allows users to back up and restore their files, directories, and system state. This utility is useful for creating automated backup tasks through scripts or scheduled tasks, ensuring data integrity and recovery in the event of hardware failure or data corruption.

Syntax

The basic syntax for NTBACKUP is as follows:

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: Includes the system state data in the backup.
  • parameters surrounded by square brackets [] are optional.
  • “/A” (Append): Appends this backup to the existing media, otherwise overwrites.

Options/Flags

  • /J {“JobName”}: Specifies the job name to be used in the backup report.
  • /F {“FileName”}: Specifies the logical or physical drive path to store the backup file.
  • /V:{yes|no}: Verifies the data after the backup is complete.
  • /R:{yes|no}: Restricts access to the owner or the administrator.
  • /L:{f|s|n}: Specifies the type of log file: f=full, s=summary, n=none.
  • /M {BackupType}: Specifies the type of backup: normal, copy, differential, incremental, or daily.
  • /SNAP:{on|off}: Uses the Volume Shadow Copy service to backup files in use.
  • /HC:{on|off}: Hardware compression if available.

Examples

  1. Backing up a single directory:
    NTBACKUP backup C:\Users\ /J "Users Backup" /F "D:\Backup\Users.bkf"
    
  2. System state backup:
    NTBACKUP backup systemstate /J "System State Backup" /F "D:\Backup\SystemState.bkf" /V:yes
    
  3. Incremental backup:
    NTBACKUP backup C:\ /M incremental /J "Incremental Backup Job" /F "D:\Backup\Incremental.bkf"
    

Common Issues

  • Access Denied Error: Ensure the command prompt is running with administrative privileges.
  • Media Full Error: Check that there is sufficient disk space on the target backup media or file.
  • Verification Failure: This could be due to bad sectors or corrupted data; try different media or running disk check tools.

Integration

Combine NTBACKUP with SCHTASKS to create scheduled backups:

SCHTASKS /Create /SC weekly /D MON /TN "Weekly User Backup" /TR "CMD /C NTBACKUP backup C:\Users\ /J 'Weekly Backup' /F 'D:\WeeklyUsersBackup.bkf'"
  • WBADMIN: Backup command utility starting from Windows Vista.
  • XCOPY: Tool for copying files and directories including various attributes.

Explore more at the official Microsoft documentation: https://docs.microsoft.com/en-us/previous-versions/windows/it-pro/windows-server-2003/cc757491(v=ws.10)