Here is available_plus for windows.
It MUST be copied in ...NetBackup\bin\goodies\
@REM
@REM $Header: available_plus.cmd,v 1.3 2005/02/01 $
@REM Original available_media.cmd 1.2 modified
@REM - ORPHAN for assigned volumes not present in mediaDB
@REM - NONE for volumes in volume pool None not subject to selection
@REM - DBBACKUP status definitely reserved for catalog backup volumes, thanks to vmstatus=1
@REM - EXPIRATION DATE instead of PARTNER SIDE (only used with optical device) This is is MEDIA Expiration Date, based on Retention Level of the longest living image in the base
@REM bcpyrght
@REM ***************************************************************************
@REM * $VRTScprght: Copyright 1993 - 2003 VERITAS Software Corporation, All Rights Reserved $ *
@REM ***************************************************************************
@REM ecpyrght
@REM
@REM available_plus.cmd
@REM
@REM This script can be used by an administrator as a convenient way to
@REM list ALL NetBackup volumes in the Volume Manager database, and
@REM augment that list with information on the volumes currently "assigned"
@REM to NetBackup.
@REM The major benefit of this script is that it eliminates the need to track
@REM information from multiple databases and do the correlation manually.
@REM
@REM This script can be used to get periodic reports of available media by
@REM registering it with the AT command.
@REM
@REM
@REM - Main program ------------------------------------------------------------
@REM -
@REM - This script only runs on NT 4.0 and succeeding versions of NT. You must
@REM - have command extensions enabled. Check the following registry entry:
@REM -
@REM - HKEY_CURRENT_USER\Software\Microsoft\Command Processor\EnableExtensions
@REM -
@REM - It should be set to 0x1 or you may have problems running this script.
@REM ---------------------------------------------------------------------------
@setlocal ENABLEEXTENSIONS
@goto StartMain
@REM - Subroutines -------------------------------------------------------------
:FormatOutput
@REM -
@REM - FormatOutput formats the output of the available_media script.
@REM ---------------------------------------------------------------------------
@REM - bpstatus=%1
@REM - vmediaid=%2
@set vmediatype=%3
@if "%vmediatype%" == "" set vmediatype=%vmediatype%
@if "%vmediatype:~1,1%" == "" set vmediatype=%vmediatype%
@if "%vmediatype:~2,1%" == "" set vmediatype=%vmediatype%
@if "%vmediatype:~3,1%" == "" set vmediatype=%vmediatype%
@if "%vmediatype:~4,1%" == "" set vmediatype=%vmediatype%
@if "%vmediatype:~5,1%" == "" set vmediatype=%vmediatype%
@if "%vmediatype:~6,1%" == "" set vmediatype=%vmediatype%
@if "%vmediatype:~7,1%" == "" set vmediatype=%vmediatype%
@REM - vrobottype=%4
@REM - vrobotnum=%5
@REM - vrobotslot=%6
@REM - vside=%7
@set bpretlev=%8
@if "%bpretlev:~1,1%" == "" set bpretlev=%bpretlev%
@REM - bpkbytes=%9
@echo %2%vmediatype% %4 %5 %6%7%bpretlev%%9%1
@goto :EOF
@REM ---------------------------------------------------------------------------
:ProcessAssignedMedia
@REM -
@REM - ProcessAssignedMedia gets the status, KBytes used and retention level of
@REM - the media.
@REM ---------------------------------------------------------------------------
@set bpstatus=
@REM set bpmediaid=%1
@shift /1
@REM set bppartner=%1
@shift /1
@REM set bpver=%1
@shift /1
@REM set bpden=%1
@shift /1
@REM set bpalloc=%1
@shift /1
@REM set bplwrite=%1
@shift /1
@REM set bpexp=%1
@set bpexp=%1
@shift /1
@REM set bplrest=%1
@shift /1
@set bpkbytes=%1
@shift /1
@REM set bpnimages=%1
@shift /1
@REM set bpvimages=%1
@shift /1
@set bpretlev=%1
@shift /1
@REM set bpunused1=%1
@shift /1
@REM set bpnumrest=%1
@shift /1
@set bpstat=%1
@REM shift /1
@REM set bprest=%1
@set ismpx=0
@REM ---------------------------------------------------------------------------
@REM - Translate bpstat into a string
@REM ---------------------------------------------------------------------------
@if NOT %bpstat% GTR 511 goto Test255
@set ismpx=1
@set /A bpstat-=512
@REM ---------------------------------------------------------------------------
:Test255
@if NOT %bpstat% GTR 255 goto Test127
@REM - Ignore this bit.
@set /A bpstat-=256
@REM ---------------------------------------------------------------------------
:Test127
@if NOT %bpstat% GTR 127 goto Test63
@set /A bpstat-=128
@set bpstatus=IMPORTED
@REM ---------------------------------------------------------------------------
:Test63
@if NOT %bpstat% GTR 63 goto Test31
@set /A bpstat-=64
@REM - Add * on retention level to indicate this media id has multiple
@REM - retention levels on it.
@set bpretlev=%bpretlev%*
@set /A ASTERISK_DISPLAYED+=1
@REM ---------------------------------------------------------------------------
:Test31
@if NOT %bpstat% GTR 31 goto Test15
@REM - Ignore this bit.
@set /A bpstat-=32
@REM ---------------------------------------------------------------------------
:Test15
@if NOT %bpstat% GTR 15 goto Test7
@REM - Ignore this bit.
@set /A bpstat-=16
@REM ---------------------------------------------------------------------------
:Test7
@if NOT %bpstat% GTR 7 goto Test3
@set /A bpstat-=8
@if NOT "%bpstatus%" == "" set bpstatus=%bpstatus%/
@set bpstatus=%bpstatus%FULL
@REM ---------------------------------------------------------------------------
:Test3
@if NOT %bpstat% GTR 3 goto Test1
@REM - Ignore this bit.
@set /A bpstat-=4
@REM ---------------------------------------------------------------------------
:Test1
@if NOT %bpstat% GTR 1 goto Test0
@set /A bpstat-=2
@if NOT "%bpstatus%" == "" set bpstatus=%bpstatus%/
@set bpstatus=%bpstatus%SUSPENDED
@REM ---------------------------------------------------------------------------
:Test0
@if NOT %bpstat% GTR 0 goto NotFrozen
@if NOT "%bpstatus%" == set bpstatus=%bpstatus%/
@set bpstatus=%bpstatus%FROZEN
@REM ---------------------------------------------------------------------------
:NotFrozen
@if NOT %ismpx% GTR 0 goto NoMpx
@if NOT "%bpstatus%" == "" set bpstatus=%bpstatus%/
@set bpstatus=%bpstatus%MPX
@goto :EOF
@REM ---------------------------------------------------------------------------
:NoMpx
@if "%bpstatus%" == "" set bpstatus=ACTIVE
@goto :EOF
@REM ---------------------------------------------------------------------------
:ProcessVolume
@REM -
@REM - ProcessVolume prints a line of output for the current volume (prior
@REM - to sorting).
@REM ---------------------------------------------------------------------------
@set vmediaid=%1
@shift /1
@set vop=%1
@shift /1
@set vmediatype=%1
@shift /1
@set vbarcode=%1
@shift /1
@set vbarpartner=%1
@shift /1
@set vrobhost=%1
@shift /1
@set vrobottype=%1
@shift /1
@set vrobotnum=%1
@shift /1
@set vrobotslot=%1
@shift /1
@set vside=%1
@shift /1
@set vvol=%1
@shift /1
@set vpool=%1
@shift /1
@set vpoolnum=%1
@shift /1
@set vprevpool=%1
@shift /1
@set vmnts=%1
@shift /1
@set vmaxmnts=%1
@shift /1
@set vclns=%1
@shift /1
@set vcrdate=%1
@shift /1
@set vcrtime=%1
@shift /1
@set vasgndate=%1
@shift /1
@set vasgntime=%1
@shift /1
@set vfmtdate=%1
@shift /1
@set vfmttime=%1
@shift /1
@set vlmtdate=%1
@shift /1
@set vlmttime=%1
@shift /1
@set vexpdate=%1
@shift /1
@set vexptime=%1
@shift /1
@set vstatus=%1
@shift /1
@set bpkbytes=?
@set bpretlev=?
@REM ---------------------------------------------------------------------------
@REM - Check if this volume has been assigned.
@REM ---------------------------------------------------------------------------
@if NOT "%vasgndate%" == "00/00/0000" goto TestCat
@if NOT "%vasgntime%" == "00:00" goto TestCat
@REM ---------------------------------------------------------------------------
@REM - The volume is not assigned.
@REM ---------------------------------------------------------------------------
@if "%vpool%" == "None" goto NonePool
@set bpstatus=AVAILABLE
@set bpkbytes=-
@set bpretlev=-
@goto EndProcessVolume
@REM ---------------------------------------------------------------------------
:NonePool
@set bpstatus=NONE
@set bpkbytes=N/A
@set bpretlev=N/A
@goto EndProcessVolume
@REM ---------------------------------------------------------------------------
@REM - The volume is assigned.
@REM ---------------------------------------------------------------------------
:TestCat
@if NOT "%vstatus%" == "1" goto MediaAssigned
@set bpkbytes=N/A
@set bpretlev=N/A
@set bpstatus=DBBACKUP
@goto EndProcessVolume
:MediaAssigned
@set bpstatus=ORPHAN
@for /F "delims=" %%i in ('%BPMEDIALIST% -mlist -l -ev %vmediaid%') do @call :ProcessAssignedMedia %%i
:EndProcessVolume
@REM ---------------------------------------------------------------------------
@REM - Print the volume information.
@REM ---------------------------------------------------------------------------
@for /F "tokens=1,2,3,4,5,6,7* delims= " %%i in ('%BPDBM% -ctime %bpexp%') do @set bpexpd=%%m%%l%%o
@set bpexpe=%bpexpd:~0,5%%bpexpd:~7,2%
@if "%bpexp%"=="0" set bpexpe=N/A
@set /A bpkbytesd=%bpkbytes%/1024
@echo %bpstatus% %vmediaid% %vmediatype% %vrobottype% %vrobotnum% %vrobotslot% %bpexpe% %bpretlev% %bpkbytesd%
@goto :EOF
---------------------------------------------------------------------------
:StripVmQueryOut
@REM -
@REM - StripVmQueryOut strips the headers from the output of vmquery.
@REM ---------------------------------------------------------------------------
@for /F "skip=2 delims=" %%i in ('%VMQUERY% -pn %1 -W') do @call :ProcessVolume %%i
@goto :EOF
@REM ---------------------------------------------------------------------------
:ListVolumes
@REM -
@REM - ListVolumes creates a list of volumes in the current pool.
@REM ---------------------------------------------------------------------------
@call :StripVmQueryOut %1 > %OUTPUT_FILE% 2> nul
@REM - Sort the records by status
@sort < %OUTPUT_FILE% > %VOLUMES%
@echo %1 pool
@%LISTPATHS% /s BlankLine
@for /F "delims=" %%i in ('type %VOLUMES%') do @call :FormatOutput %%i
@%LISTPATHS% /s BlankLine
@goto :EOF
@REM ---------------------------------------------------------------------------
:ListVolumePools
@REM -
@REM - ListVolumePools creates a list of the volume pools.
@REM ---------------------------------------------------------------------------
@for /F "skip=2" %%i in ('%VMPOOL% -listall -b') do @echo %%i
@goto :EOF
@REM - continue Main program ---------------------------------------------------
:StartMain
@REM ---------------------------------------------------------------------------
@REM - Make sure the user is not running another instance of available_media
@REM - because of the use of temporary output files.
@REM ---------------------------------------------------------------------------
@set LISTPATHS="%~dp0\listpaths"
@set LOCKFILE="%TEMP%\AM.%USERNAME%.lok"
@if NOT exist %LOCKFILE% goto SetLock
@echo You are already running Available_Media. 1>&2
@echo Try again later. 1>&2
@goto EndMain
:SetLock
@echo %USERNAME% > %LOCKFILE%
@REM ---------------------------------------------------------------------------
@REM - Locate the Media Manager binaries.
@REM ---------------------------------------------------------------------------
@for /F "delims=|" %%p in ('%LISTPATHS% /s VM_BIN_VMQUERY') do @set VMQUERY="%%p"
@for /F "delims=|" %%p in ('%LISTPATHS% /s VM_BIN_VMPOOL') do @set VMPOOL="%%p"
@for /F "delims=|" %%p in ('%LISTPATHS% /s BPMEDIALIST') do @set BPMEDIALIST="%%p"
@for /F "delims=|" %%p in ('%LISTPATHS% /s BP_BIN') do @set BPDBM="%%p\bpdbm"
@REM ---------------------------------------------------------------------------
@REM - Create the output file names.
@REM ---------------------------------------------------------------------------
@set OUTPUT_FILE="%TEMP%\AM.%USERNAME%.out"
@set POOLS="%TEMP%\AM.%USERNAME%.pools"
@set VOLUMES="%TEMP%\AM.%USERNAME%.volumes"
@REM ---------------------------------------------------------------------------
@REM - Create an alphabetized volume pool list (AM..pools).
@REM ---------------------------------------------------------------------------
@call :ListVolumePools > %OUTPUT_FILE% 2> nul
@sort < %OUTPUT_FILE% > %POOLS%
@REM ---------------------------------------------------------------------------
@REM - Print the column labels.
@REM ---------------------------------------------------------------------------
@echo mediamediarobotrobotrobotexpret sizestatus
@echo IDtypetype #slotdatelevel MBytes
@echo ----------------------------------------------------------------------------
@REM ---------------------------------------------------------------------------
@REM - For each volume pool, list the volumes.
@REM ---------------------------------------------------------------------------
@set ASTERISK_DISPLAYED=0
@for /F %%i in ('type %POOLS%') do @call :ListVolumes %%i
@if %ASTERISK_DISPLAYED% EQU 0 goto CleanUp
@REM ---------------------------------------------------------------------------
@REM - Add multiple retention level footnote.
@REM ---------------------------------------------------------------------------
@%LISTPATHS% /s BlankLine
@echo * - More than 1 retention level present.
@%LISTPATHS% /s BlankLine
@REM ---------------------------------------------------------------------------
:CleanUp
@if exist %VOLUMES% del %VOLUMES%
@del %OUTPUT_FILE%
@del %POOLS%
@del %LOCKFILE%
:EndMain
@endlocal
@REM - End of Main Program -----------------------------------------------------