PowerShell script exchange
Post Reply
adam900331
Veteran
Posts: 316
Liked: 22 times
Joined: Dec 01, 2019 7:27 pm
Contact:

PowerShell get tape in mailslot

Post by adam900331 »

Hy!

Is there any VBR PowerShell command to list the exported tape, which is currently in the mailslot? I can't find solution for it.

The Get-VBRTapeMedium lis only the tapes, but I can't find a parameter which related to the mailslot.

Thanks.
david.domask
Veeam Software
Posts: 2365
Liked: 558 times
Joined: Jun 28, 2016 12:12 pm
Contact:

Re: PowerShell get tape in mailslot

Post by david.domask » 1 person likes this post

Hi @adam900331,

Right now we don't track that with the cmdlets as far as I know. Get-VBRTapeMedium will have a Property "Location" and it will show as "none" if the tape is in the IESlot OR Offline.

I'm checking if we have an unsupported method for parsing this, but can I ask:

1. Do you need the exact IESlot ID or just that it's in an IESlot?
2. When you export a tape from the UI (not part of job), there is a small dialogue window on where it exported; would parsing that info be useful or you need to check any time there is a tape in the IESlot?

Depending on your answer, I have a few ideas for you.
David Domask | Product Management: Principal Analyst
adam900331
Veteran
Posts: 316
Liked: 22 times
Joined: Dec 01, 2019 7:27 pm
Contact:

Re: PowerShell get tape in mailslot

Post by adam900331 »

Hy,

The Get-VBRTapeMedium has a "Location" Property, but this contain all of the offline tapes (which in mailslot and which not in tape library).

When start the tape export process from GUI, the dialog window show: Exporting tape "tapid" from Slot 2 to I/E port 0.

I would like to create a PowerShell script, which check there is an exported tape in mailslot. If yes, send an e-mail to an e-mail address until someone open the mailslot and take out the tape.

Thanks.
david.domask
Veeam Software
Posts: 2365
Liked: 558 times
Joined: Jun 28, 2016 12:12 pm
Contact:

Re: PowerShell get tape in mailslot

Post by david.domask »

Hi @adam900331,

I checked around on unsupported ways of doing this, and didn't find anything "clean", but I'd like to offer a maybe strange but supported way; using the Veeam Tape Service Dump.

The Veeam Tape Service lives on the Tape Server under C:\Program Files (x86)\Veeam\Backup Tape. If you start the executable with the --dump parameter on v12, it will output an XML file reporting on the tape devices connected as the tape server and Veeam report it, including the IESlots.

You can fetch this into an XML object in Powershell with the following (run on the tape server):

Code: Select all

[xml]$TapeResults = & 'C:\Program Files (x86)\Veeam\Backup Tape\VeeamTapeSvc.exe' --dump
Navigating the XML in powershell is very simple, and you can just parse on:

$TapeResults.Dump.Devices.IEPortsStatuses.IEPortStatus; each of the objects here will map to your IESlots, and the PrimaryVolumeID is what you're interested in:

Code: Select all

PS C:\Program Files (x86)\Veeam\Backup Tape> $TapeResults.Dump.Devices.IEPortsStatuses.IEPOrtStatus


SerialNumber          :
Lun                   : 0
ProductIdentification :
VendorIdentification  :
AlternateVolumeID     :
PrimaryVolumeID       :  #This fella right here
TargetId              : 0
ExceptionCode         : 0
Flags                 : 276824120
Element               : Element
SrcElementAddress     : SrcElementAddress
So if something exists in the PrimaryVolumeID (it will show a barcode), it means something is in the IE slots.

So, what you might do is either write a script that lives on the Tape Server and check, or PSRemote from the VBR to the Tape Server and check accordingly. Keep in mind that the XML can get pretty big for larger tape environments (we're talking MiB in size), so just plan accordingly that some data might need to go across the wire here, but nothing outrageous, no more than 50 MiB would be a rough guess for _huge_ tape environments (think like 10+ drives and thousands of tape slots)

Play with that a bit and see what you can come up with. This method is supported as this is exactly how we get diagnostic information on tape hardware, and I think you'll find it quite useful.

NOTE: v12 changed the flags the Tape Service accepts; if you have v11 or a mix of v11 and v12 environments, let me know I'll show you how I handled this for our Tape Diagnostics Script
David Domask | Product Management: Principal Analyst
adam900331
Veteran
Posts: 316
Liked: 22 times
Joined: Dec 01, 2019 7:27 pm
Contact:

Re: PowerShell get tape in mailslot

Post by adam900331 »

Thanks, David. I will try this scenario, and I will give feedback!
Post Reply

Who is online

Users browsing this forum: No registered users and 12 guests