Creating a batch script |
Top Previous Next |
The next step is to create the batch file that we will later schedule to run the attended backup. You can basically take the template listed in the next chapters and make minor modifications to make it work on your server. Please note that we have two templates, one for a regular tape backup and one for a file backup (when backing up to a file).
Before you create the batch file you will need to determine the following variables. You can click on the underlined names below for more information on how to determine the name.
Once you have determined all the required names, replace the strings (e.g. [BACKUP_DESTINATION]) in the templates with the actual value (e.g. 4mm DDS) and save the file in a .cmd file.
Example For example, let's say you want to backup the selection you saved in C:\Batch\NTBackup_Daily.bks file to the Quantum DLT4000 SCSI Sequential Device, which is a DLT drive. The resulting script would look like this:
REM DOS script to automate backup using ntbackup.exe to a tape device
rsm.exe refresh /LF"Quantum DLT4000 SCSI Sequential Device"
sleep 30
REM Create Backup Name based on date and time for /f "Tokens=1-4 Delims=/ " %%i in ('date /t') do set DT=%%i-%%j-%%k-%%l for /f "Tokens=1" %%i in ('time /t') do set TM=-%%i
set TM=%TM::=-% set DTT=%DT%%TM%
REM Execute Backup %SYSTEMROOT%\system32\NTBACKUP.EXE backup "@C:\Batch\NTBackup_Daily.bks" /n "%DTT%" /d "%DTT%" /v:no /r:no /rs:no /hc:on /m normal /j "%DTT%" /l:f /p "DLT" /um
REM Eject Tape rsm.exe eject /PF"%DTT% - 1" /astart
exit
Save the contents of the file in a directory of your choice, for example C:\Batch\NTBackup_Daily.cmd. We schedule this backup to run daily on weekdays in the next chapter. |