Skip navigation

JSI Tip 5961. How do I Deallocate the mounted tape in a command script?


In tip 5955, I used the RSM VIEW command to determine if a tape was inserted in a tape drive.

Using rsm view /cgC888E08900454C4C956DF84868C17C78 /TPhysical_media, where C888E08900454C4C956DF84868C17C78 is the GUID of my tape library, the following commands set the media variable to the Physical_Media id of the mounted tape:

set media=
for /f "Skip=2 Tokens=*" %%a in ('rsm view /cgC888E08900454C4C956DF84868C17C78 /TPhysical_media') do if not "%%a"=="The command completed successfully." set media="%%a"
if not defined media goto notape
You can use the Partition Id with the Deallocate command.

To determine the Partition Id and issue a Deallocate:

set partition=%media: - 1=%
rsm.exe deallocate /PF%partition%



Hide comments

Comments

  • Allowed HTML tags: <em> <strong> <blockquote> <br> <p>

Plain text

  • No HTML tags allowed.
  • Web page addresses and e-mail addresses turn into links automatically.
  • Lines and paragraphs break automatically.
Publish