PowerShell script exchange
Post Reply
bentheninjarock
Lurker
Posts: 2
Liked: 1 time
Joined: Feb 27, 2024 3:23 pm
Full Name: Ben Craigs
Contact:

Tape library serial code

Post by bentheninjarock »

Hi all,
I can see the serial number of a tape library in the GUI, but I want to be able to pull that via PowerShell script.
The get-vbrtapelibrary returns everything but the serial number.
Any ideas?
TIA
david.domask
Veeam Software
Posts: 1226
Liked: 322 times
Joined: Jun 28, 2016 12:12 pm
Contact:

Re: Tape library serial code

Post by david.domask »

Hi @bentheninjarock,

Seems we don't return it for some reason on Get-VBRTapeLibrary or I'm just blind and cannot find it.

As a workaround, you can use the following unsupported method to retrieve it.

Code: Select all

Get-VBRLicenseAutoUpdateStatus | Out-Null #you need to run _any_ Veeam cmdlet in your script before you can cast .NET Reflections, but this is a fast one I usually
$changers = [Veeam.Tape.Core.AutomatedLibrary]::GetAll().GetChanger()
The returning objects will have a method GetDevice() which you can call to get the serial:

Code: Select all

PS C:\Users\Administrator> $changers[0].GetDevice()


Devices      : Veeam.Tape.Core.DeviceRepository
Id           : 0d68339b-4c19-4ed2-95c1-2800e655e9a1
Name         : Changer0
Type         : Changer
SymbolicLink : \\.\Changer0
State        : Online
IsLocked     : False
SerialNumber : BE41200010
But this should be returned by Get-VBRTapeLibrary in my humble opinion, will discuss internally.
David Domask | Product Management: Principal Analyst
bentheninjarock
Lurker
Posts: 2
Liked: 1 time
Joined: Feb 27, 2024 3:23 pm
Full Name: Ben Craigs
Contact:

Re: Tape library serial code

Post by bentheninjarock » 1 person likes this post

That works great, thank you!
david.domask
Veeam Software
Posts: 1226
Liked: 322 times
Joined: Jun 28, 2016 12:12 pm
Contact:

Re: Tape library serial code

Post by david.domask »

Glad it worked, and happy to help! And I will note a request for improvements on this particular item (or for someone to point where I am missing it :) )
David Domask | Product Management: Principal Analyst
Post Reply

Who is online

Users browsing this forum: No registered users and 16 guests