Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Name of the tape in the device???

72 views
Skip to first unread message

Nelson Rodriguez

unread,
Jun 18, 2003, 1:48:02 PM6/18/03
to
Hello Guys.
How can I know the name of the tape in the tape device??? (in a W2K Server).
Using WSH-WMI-VB-VBS.

Thanks
Bye

Nelson Rodriguez
n...@adinet.com.uy
Salto - Uruguay


Ross Presser

unread,
Jun 18, 2003, 4:05:48 PM6/18/03
to
"Nelson Rodriguez" <n...@adinet.com.uy> wrote in
news:uvbjGJcN...@TK2MSFTNGP12.phx.gbl:

> 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

Nelson Rodriguez

unread,
Jun 20, 2003, 12:39:33 PM6/20/03
to
Ross I has error in this line:

cGUID(1) = getResource("MediaLibraryGUID")

Can you help me more?
Thanks
Nelson

"Ross Presser" <rpre...@NOSPAM.imtek.com.invalid> escribió en el mensaje
news:Xns939EA3BE...@129.250.170.94...

Ross Presser

unread,
Jun 20, 2003, 1:52:28 PM6/20/03
to
"Nelson Rodriguez" <n...@adinet.com.uy> wrote in news:#YgANs0NDHA.3192
@TK2MSFTNGP10.phx.gbl:

> Ross I has error in this line:
> cGUID(1) = getResource("MediaLibraryGUID")
>
> Can you help me more?

Read what I wrote.

> <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>

0 new messages