PowerShell script exchange
Post Reply
pierre-benoit.gerber
Novice
Posts: 4
Liked: 3 times
Joined: Dec 08, 2020 3:43 pm
Full Name: Pierre-Benoit Gerber
Contact:

Get Tape Library Slot ID using Powershell

Post by pierre-benoit.gerber »

Hello,

I would like to get the tape slot ID in the library with Powershell.
But the Location property of the Get-VBRTapeMedium command only shows "Slot" or "Vault" but not "Slot ID" like in the GUI.
Am I missing something or is this a limitation with Powershell?
pierre-benoit.gerber
Novice
Posts: 4
Liked: 3 times
Joined: Dec 08, 2020 3:43 pm
Full Name: Pierre-Benoit Gerber
Contact:

Re: Get Tape Library Slot ID using Powershell

Post by pierre-benoit.gerber » 1 person likes this post

Difference between Powershell ouput and GUI.
In powershell I can't get the Slot ID number:
Image
Image
HannesK
Product Manager
Posts: 15127
Liked: 3232 times
Joined: Sep 01, 2014 11:46 am
Full Name: Hannes Kasparick
Location: Austria
Contact:

Re: Get Tape Library Slot ID using Powershell

Post by HannesK » 1 person likes this post

Hello,
that looks like a bug for me. I reproduced it in 12.3 and will open a case.

Best regards
Hannes
pierre-benoit.gerber
Novice
Posts: 4
Liked: 3 times
Joined: Dec 08, 2020 3:43 pm
Full Name: Pierre-Benoit Gerber
Contact:

Re: Get Tape Library Slot ID using Powershell

Post by pierre-benoit.gerber »

Hello,
Thank you Hannes.
david.domask
Veeam Software
Posts: 2590
Liked: 606 times
Joined: Jun 28, 2016 12:12 pm
Contact:

Re: Get Tape Library Slot ID using Powershell

Post by david.domask »

I'm not sure it's a bug personally, but will wait for @HannesK to confirm.

Reason I think this is that the Location property isn't a static value, it's calling another method to return a Veeam Powershell Type VBRTapeMediumLocation:

https://helpcenter.veeam.com/docs/backu ... ml?ver=120

You can actually see with Get-Member:

Location Property Veeam.Backup.PowerShell.Infos.VBRTapeMediumLocation Location {get;}

Calling this property will return the information. For example:

Code: Select all

PS C:\Users\david.LAB> $testTape = Get-VBRTapeMedium -Name "H00023L5"
PS C:\Users\david.LAB> $testTape.Location


DriveId      :
DriveAddress :
LibraryId    : f850b166-4582-47cc-a869-66c4aef79c16
SlotAddress  : 22
VaultId      :
Type         : Slot
This would indicate that the tape is in Slot 23 as shown in the UI (SlotAddress = 22 in my output there, but this is 0-indexed, so we count from 0 to 22 which gives us Slot 23)

I think the idea of the top-level property is just to return the location type, and if you want more specifics, you delve into the property to get the actual SlotAddress.
David Domask | Product Management: Principal Analyst
pierre-benoit.gerber
Novice
Posts: 4
Liked: 3 times
Joined: Dec 08, 2020 3:43 pm
Full Name: Pierre-Benoit Gerber
Contact:

Re: Get Tape Library Slot ID using Powershell

Post by pierre-benoit.gerber » 2 people like this post

Hello David,

Thank you, I forgot to check the Location Property!
My customers will be happy to know in witch magazine will be the tapes to check-out for the new year :)
Image
david.domask
Veeam Software
Posts: 2590
Liked: 606 times
Joined: Jun 28, 2016 12:12 pm
Contact:

Re: Get Tape Library Slot ID using Powershell

Post by david.domask »

Glad I could help!

Looks like a useful script as well :) If you're able and willing to share the script here, looks like it'd be a very useful one for many others.
David Domask | Product Management: Principal Analyst
Post Reply

Who is online

Users browsing this forum: No registered users and 14 guests