Tape Library Inventory Report

Userlevel 5
Badge +3

Hey all,

Again, hope it’s not spam, but wanted to share some custom code that came up for the purpose of a case and let the community have it also (since why not?)


  • You want to have an inventory of
    • Current Tape Locations
    • Library Association
    • Other Tape Elements

There isn’t really a “nice” VeeamOne report for this (vOne just reports on Vaulted Tapes), and checking the tape WebUI isn’t always convenient nor is checking the Veeam Tape node.

If you find a need for this, check this out:

using namespace System.Collections.Generic
function Get-VBRTapesInLibrary {
$TapesInLibrary = Get-VBRTapeMedium | Where-Object {$_.LibraryID -eq $Library.id}
return $TapesInLibrary

function New-TapeLocationPropertiesObject {
$TapeBarcode = $tapemedium.Barcode
$TapeName = $tapemedium.Name
$TapeLocation = $tapemedium.Location.Type
if($tapemedium.Location.Type -eq "Drive"){
$LocationAddress = ($Drives | Where-Object {$_.id -eq $tapemedium.Location.DriveID}).Name
} else {
$LocationAddress = $tapemedium.Location.SlotAddress
$TapeLibrary = $Libraries | Where-Object {$_.id -eq $tapemedium.LibraryID}
$TapeObjectProperties = [PSCustomObject]@{
TapeBarcode = $TapeBarcode
TapeName = $TapeName
TapeLocation = $TapeLocation
LocationAddress = $LocationAddress
TapeLibrary = $TapeLibrary.Name
return $TapeObjectProperties

$Libraries = Get-VBRTapeLibrary
$Drives = Get-VBRTapeDrive
$LibraryInventory = [List[Object]]@()
Foreach($tl in $Libraries){
$TapesInLibrary = Get-VBRTapesInLibrary -Library $tl
Foreach($tape in $TapesInLibrary){
$TapeProperties = New-TapeLocationPropertiesObject -tapemedium $tape

$LibraryInventory | Export-Csv -NoTypeInformation -Path C:\temp\TapeLibraryInventoryReport.csv

You can add properties from  Veeam.Backup.PowerShell.Infos.VBRTapeMedium objects to the function New-TapeLocationPropertiesObject as you desire. Vaulting information should be there also to help track it, but the above is a simple example on how to build this for easy tracking. 

Naturally this will not give you the _contents_ of tapes, but I know it’s not uncommon to have such reports that can be moved to various reporting services.

Change out the Export-CSV to whatever you desire/need for your reporting (e.g., use ConvertTo-JSON if you need JSON, or write a function for other mark-up languages)

Hope someone finds this useful!


Example CSV output:




Userlevel 7
Badge +15

Interesting. Such reports are indeed missing and it is very useful if you are doing some kind of vaulting.

Userlevel 7
Badge +20

Any scripts to benefit the community is not spam.  Thanks for sharing as these are always great to have.