
Name of the tape in the device???
Quote:
> Hello Guys.
> How can I know the name of the tape in the tape device??? (in a W2K
> Server). Using WSH-WMI-VB-VBS.
Maybe you can use this as a starting point:
<comment>
This GUID identifies the media library associated with the
tape drive.
To get it, run the command RSM VIEW /GUIDDISPLAY /tLIBRARY,
and pick the GUID for your tape drive. This is *only* used
to drill down to the GUID of the specific tape currently
inserted, in case we want to append to the tape.
</comment>
<resource id="MediaPool">"DLT"</resource>
<resource id="MediaLibraryGUID">F8EF5F961A614105B434AA8114880B99</resource>
function IdentifyInsertedTape()
dim oRun, cGUID(4)
' Library GUID for this tape drive
cGUID(1) = getResource("MediaLibraryGUID")
' refresh removable storage library
set oRun=wsh.exec("RSM refresh /lg" & cGUID(1))
do while oRun.status=0 : wscript.sleep 100 : loop
' get physical media GUID
set oRun=wsh.exec("RSM view /b /guiddisplay /tPHYSICAL_MEDIA /cg" & cGUID(1))
do while oRun.status=0 : wscript.sleep 100 : loop
cGUID(2) = "" & firstGUID(oRun.Stdout.Readall())
' wscript.echo cGUID(2)
if len(cGUID(2))=0 then
LogMsg "ERROR: Can't get PHYSICAL_MEDIA GUID; maybe no tape in drive?"
LogMsg "CLOSE"
wscript.quit
end if
' get partition GUID
set oRun=wsh.exec("RSM view /b /guiddisplay /tPARTITION /cg" & cGUID(2))
do while oRun.status=0 : wscript.sleep 100 : loop
cGUID(3) = "" & firstGUID(oRun.Stdout.Readall())
' wscript.echo cGUID(3)
if len(cGUID(3))=0 then
LogMsg "ERROR: Can't get PARTITION GUID; maybe unreadable tape?"
LogMsg "CLOSE"
wscript.Quit
end if
' get logical media GUID
set oRun=wsh.exec("RSM view /b /guiddisplay /tLOGICAL_MEDIA /cg" & cGUID(3))
do while oRun.status=0 : wscript.sleep 100 : loop
cGUID(4) = "" & firstGUID(oRun.Stdout.Readall())
' wscript.echo cGUID(4)
if len(cGUID(4))=0 then
LogMsg "NOTE: Can't get LOGICAL_MEDIA GUID; assuming blank tape"
IdentifyInsertedTape="BLANK_MEDIA"
exit function
end if
' add dashes to logical media GUID
IdentifyInsertedTape = left(cGUID(4),8) & "-" & mid(cGUID(4),9,4) & "-" _
& mid(cGUID(4),13,4) & "-" & mid(cGUID(4),17,4) & "-" & mid(cGUID(4),21,12)
end function
--
Ross Presser -- rpresser AT imtek DOT com
"... VB is essentially the modern equivalent of vulgar Latin in 13th
Centurary Europe. Understand it, and you can travel to places you never
heard of and still understand some people." -- Alex K. Angelopoulos