JSI Tip 5955. How can my scheduled Ntbackup react to my failure to insert a tape in the tape drive?
November 12, 2002
I would occasionally forget to insert a tape in my tape drive, and arrive the next morning to find that my scheduled Ntbackup is waiting for me to mount a tape.
To avoid this behavior, I first determined the GUID of my tape device, by opening a CMD prompt and typing:
rsm view /tlibrary /guiddisplay.
This returned a display that included:
HP C1537A SCSI Sequential Device C888E08900454C4C956DF84868C17C78.
If you type:
rsm view /cgC888E08900454C4C956DF84868C17C78 /TPhysical_media
you receive a display similar to:
PHYSICAL_MEDIA
2002_10_30_18_00 - 1
The command completed successfully.
where 2002_10_30_18_00 - 1 is the tape label.
Using this information, I added the following to my script, before the Ntbackup command:
:checkmediaset media=for /f "Tokens=*" %%a in ('rsm view /cgC888E08900454C4C956DF84868C17C78 /TPhysical_media') do ( if not "%%a"=="The command completed successfully." set media="%%a")if /i %media% EQU "Unable to open session with the RSM server." goto checkmediaif /i %media% EQU "PHYSICAL_MEDIA" goto notapeif not defined media goto notape
At the :notape label, I emailed myself a message and aborted the scheduled backup.
NOTE: If I knew that someone was in the office, I could have also used net send.
About the Author
You May Also Like