Skip to main content
Solved

Using Powershell to query for online only tapes


Forum|alt.badge.img+1

Hello. We have a policy to export all tapes currently in a library that are marked FULL. I can get a list of all FULL tapes in a media pool like this:


[String] $LibraryName         = Get-VBRTapeLibrary | Select -Expandproperty Name
$TapesToBeEjected     = Get-VBRTapeMedium -Library $LibraryName | Where {$_.IsFull -eq "TRUE"} | Select Name, LastWriteTime, MediaPoolID | Sort -Property Name
 

(there’s more to my script, but that is the relevant querying section)

 

However, that gives me *all* tapes in the pool that are FULL, and I want only the tapes in a pool that are currently ONLINE in a library that are FULL (so it can send an email to the tape operators and tell them to go export the tape(s)). And I have not found a way to do that - I don’t see any property that is returned that shows ONLINE or OFFLINE of a specific tape. Am I just missing it? Is there way to query for this, so I can send an alert email (as a scheduled task)? Or is there some other way to do it? (we don’t have a license for Veeam ONE). This is VBR 12.0.

 

Thanks for any help.

 

Best answer by JMeixner

You can check the location parameter of each tape.

Online tapes have a location type of “Slot” or “Drive”, all others are not in the library.

I got the tape information with Get-VBRTapeMedium

$tape[0]].Location


DriveId      :

DriveAddress :

LibraryId    : xxxxxxxx-yyyy-zzzz-aaaa-bbbbbbbbbbbb

SlotAddress  : 23

VaultId      :

Type         : Slot

View original
Did this topic help you find an answer to your question?

3 comments

JMeixner
Forum|alt.badge.img+16
  • On the path to Greatness
  • 2684 comments
  • Answer
  • November 29, 2023

You can check the location parameter of each tape.

Online tapes have a location type of “Slot” or “Drive”, all others are not in the library.

I got the tape information with Get-VBRTapeMedium

$tape[0]].Location


DriveId      :

DriveAddress :

LibraryId    : xxxxxxxx-yyyy-zzzz-aaaa-bbbbbbbbbbbb

SlotAddress  : 23

VaultId      :

Type         : Slot


Forum|alt.badge.img+1
  • Author
  • Comes here often
  • 42 comments
  • November 30, 2023
JMeixner wrote:

You can check the location parameter of each tape.

Online tapes have a location type of “Slot” or “Drive”, all others are not in the library.

I got the tape information with Get-VBRTapeMedium

$tape[0]].Location


DriveId      : DriveAddress : LibraryId    : xxxxxxxx-yyyy-zzzz-aaaa-bbbbbbbbbbbb SlotAddress  : 23 VaultId      : Type         : Slot

AH HA! That’s great. I now have this:

(I had to convert the location to a string, because of the type of property it is. Also, I try to write it so my co-workers, who aren’t good at scripting, can at least follow along, even if it’s not the most efficient programming code)

        $TapeIsFull                        = $Tape.IsFull
        [String] $TapeLocation        = $Tape.Location
        $TapeIsOffSite                    = ($TapeLocation -eq "None")
        IF ((-not $TapeIsOffSite) -and ($TapeIsFull)) {
 

But that’s what I’m looking for!

 

Thanks!


JMeixner
Forum|alt.badge.img+16
  • On the path to Greatness
  • 2684 comments
  • November 30, 2023

You are welcome.

I think I have read that you can set the location value by yourself, so you can keep track of your tapes. But I haven't tried it yet, therefore without guarantee...