PowerShell script exchange
Post Reply
timgowen
Influencer
Posts: 21
Liked: never
Joined: Aug 22, 2017 8:34 am
Full Name: Tim Gowen
Contact:

Listing Tapes with Powershell

Post by timgowen »

I am trying to get a list of Tapes and the detail for each tape - Membership of GFS Set would be ideal.

This from the forum:

Code: Select all

asnp VeeamPSSnapin
Get-VBRTapeMedium |  Select-Object -Property @{N="Tape Name";E={$_.name}}, @{N="Barcode";E={$_.Barcode}}, @{N="Media Set";E={$_.MediaFamilyItem.GetMediaFamily().name}},@{N="Media Pool";E={$_.FindMediaPool().name}}
Gives me a blank Media Set and Media Pool


Tape Name Barcode Media Set Media Pool
--------- ------- --------- ----------
000242L8 000242L8
000139L6 000139L6

And I can't work out why...
oleg.feoktistov
Veeam Software
Posts: 2010
Liked: 670 times
Joined: Sep 25, 2019 10:32 am
Full Name: Oleg Feoktistov
Contact:

Re: Listing Tapes with Powershell

Post by oleg.feoktistov »

Hi Tim,

That's because MediaFamilyItem property and GetMediaFamily()/FindMediaPool() dynamic methods are no longer implemented in VBRTapeMedium PS type.
The good news is that you can use relevant properties instead:

Code: Select all

Get-VBRTapeMedium |  Select-Object -Property @{n="Tape Name";e={$_.name}}, Barcode, @{n="Media Set";e={$_.MediaSet}}, @{n="Media Pool";e={$_.MediaPoolId}}
If you want to retrieve media pool name specifically, the other way around is:

Code: Select all

$medium = Get-VBRTapeMedium
$mediumFiltered = @()
foreach ($media in $medium) {
    $poolId = $media.MediaPoolId
    $pool = Get-VBRTapeMediaPool -Id $poolId
    $mediumFiltered += $media | select @{n='Tape Name';e={$_.Name}}, Barcode, @{n='Media Set';e={$_.MediaSet}}, @{n='Media Pool';e={$pool.Name}}
} 

Best regards,
Oleg
Post Reply

Who is online

Users browsing this forum: No registered users and 7 guests