Submitted By: Lance Floden

Runs NTBackup and appends the data to an existing backup tape. Requires Sleep.exe.

Visual Basic
Edit|Remove
@echo off
rem NTBACKUP and append to a tape with existing data
rem
rem First you need to get your tape drive GUID
rem Open a command prompt and type rsm view /Tlibrary /guiddisplay
rem Replace the GUID below with the GUID returned for the tape drive
rem I.E. - My GUID was D502F4F122974C44B5E1D1E0AF160134
rem
set drvguid=D502F4F122974C44B5E1D1E0AF160134
rem
rem Next we force a RSM library refresh
rem
rsm.exe refresh /LG%drvGUID%
rem
rem Next we wait for the tape drive to become ready
rem You might have to increase the Sleep this number if you are using a larger tape drive.
rem
sleep 600
rem
rem Now we get the tape information
rem 
FOR /F "usebackq delims==" %%i IN (`rsm view /tphysical_media /cg%drvguid% /guiddisplay /b`) DO set tapeguid=%%i
FOR /F "usebackq delims==" %%i IN (`rsm view /tpartition /cg%tapeguid% /guiddisplay /b`) DO set partguid=%%i
FOR /F "usebackq delims==" %%i IN (`rsm view /tlogical_media /cg%partguid% /guiddisplay /b`) DO set logguid=%%i
rem 
rem Next we put the hyphen back in the name so it's usable
rem 
set p1=%logguid:~0,8%
set p2=%logguid:~8,4%
set p3=%logguid:~12,4%
set p4=%logguid:~16,4%
set p5=%logguid:~20,12%
set bkguid=%p1%-%p2%-%p3%-%p4%-%p5%
rem 
rem Use the NTBACKUP GUI to create the .bks file & save it to c:\batch
rem Modify the line below to include name of the .bks file
rem Schedule via the Task Scheduler
rem 
ntbackup backup "@c:\batch\fullbackup.bks" /g "%bkguid%" /a /v:no /hc:on /m differential