Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations bkrike on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Backup Batch File Query

Status
Not open for further replies.

Otacustes

IS-IT--Management
Apr 15, 2005
40
GB
Hi all,
I am trying to use a batch file to automate a backup procedure. At the

end of a particular part of the script, shown below, the variable bkguid should

contain the GUiD of the tape drive and will then be used as part of the

NTBACKUP.exe command line.

What I currently have is:

@echo off
REM ===== Get the tape drive name from Device Manager =====
SET TapeDriveName=SONY CD-RW CRX230E

Rem Note that there is a tab after delims.
FOR /F "usebackq delims=<tab> tokens=1,2" %%i IN (`rsm view /tlibrary

/guiddisplay`) DO IF /i "%%i"=="%TapeDriveName%" SET TapeLibraryGuid=%%j

REM =====Get the GUID from the tape=====
FOR /F "usebackq" %%i IN (`rsm view /tphysical_media /cg%TapeLibraryGuid%

/guiddisplay /b`) DO set tapeguid=%%i

REM =====Get the partition for the tape====
FOR /F "usebackq" %%i IN (`rsm view /tpartition /cg%tapeguid% /guiddisplay /b`) DO

set partguid=%%i

REM =====Get the logical media GUID====
FOR /F "usebackq" %%i IN (`rsm view /tlogical_media /cg%partguid% /guiddisplay

/b`) DO set logguid=%%i

REM =====The logical GUID is not in the 8-4-4-4-12 that NTBACKUP needs
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%

Echo %bkguid%

pause

The trouble is that that all I get back is:

convert ----

I am currently using the name of a CD writer as the tapedrivename variable for

elimination purposes - the effect is the same no matter what tape drive I use from

the RSM library on the computer.

If anybody can advise me of where I have gone wrong (why I cannot get the correct

GUID) it would be much appreciated.

Thanks


All help is greatly appreciated
Kind regards
Ota
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top