Src/Private/Get-VbrBackupTapeDrivesInfo.ps1

function Get-VbrBackupTapeDrivesInfo {
    <#
    .SYNOPSIS
        Function to extract veeam backup & replication tape drives information.
    .DESCRIPTION
        Build a diagram of the configuration of Veeam VBR in PDF/PNG/SVG formats using Psgraph.
    .NOTES
        Version: 0.5.3
        Author: Jonathan Colon
        Twitter: @jcolonfzenpr
        Github: rebelinux
    .LINK
        https://github.com/rebelinux/Veeam.Diagrammer
    #>

    [CmdletBinding()]
    [OutputType([System.Object[]])]

    Param (
        [string] $TapeLibrary
    )

    process {
        Write-Verbose -Message "Collecting Tape Drives information from $($VBRServer.Name)."
        try {

            if ($TapeLibrary) {
                $TapeDrives = Get-VBRTapeDrive -Library $TapeLibrary
            } Else {$TapeDrives = Get-VBRTapeDrive}

            $BackupTapeDriveInfo = @()
            if ($TapeDrives) {
                foreach ($TapeDrive in $TapeDrives) {

                    $Rows = [ordered ]@{
                        # Role = 'Tape Drive'
                        'Serial#' = $TapeDrive.SerialNumber
                        Model = $TapeDrive.Model
                        'Drive ID' = $TapeDrive.Name
                    }


                    $TempBackupTapeDriveInfo = [PSCustomObject]@{
                        Name = "$((Remove-SpecialChar -String ($TapeDrive.Name) -SpecialChars '\').toUpper())_$(Get-Random)"
                        Label = Get-NodeIcon -Name "$((Remove-SpecialChar -String ("Drive $($TapeDrive.Address + 1)").split(".")[0] -SpecialChars '\').toUpper())" -Type 'VBR_Tape_Drive' -Align "Center" -Rows $Rows
                        LibraryId = $TapeDrive.LibraryId
                        Id = $TapeDrive.Id
                    }

                    $BackupTapeDriveInfo += $TempBackupTapeDriveInfo
                }
            }

            return $BackupTapeDriveInfo
        }
        catch {
            $_
        }
    }
    end {}
}