PowerShell script exchange
Post Reply
mc1903
Enthusiast
Posts: 44
Liked: never
Joined: May 12, 2010 7:24 pm
Full Name: mc1903
Contact:

v8 Tape Media Locations.

Post by mc1903 »

Hi,

I am struggling to get the media location for given media.

I would like a report that identifies the location of protect media - either by Library slot (if still online) or in which vault (if offline)

So far I have the following working:

Code: Select all


Get-VBRTapeMedium | Where-Object { $_.IsExpired -eq $False -and $_.IsFree -eq $False} | Sort-Object {$_.ExpirationDate} | Select-Object -Property @{N="Barcode";E={$_.Barcode}}, @{N="Protected Until";E={$_.ExpirationDate}}, @{N="Location";E={$_.Location}}

and I get this output

Code: Select all


Barcode                                                                    Protected Until                                                            Location                                                                 
-------                                                                    ---------------                                                            --------                                                                 
GMC167L5                                                                   20/05/2015 22:14:43                                                        Vault                                                                    
GMC160L5                                                                   21/05/2015 01:36:00                                                        Vault                                                                    
GMC161L5                                                                   28/05/2015 15:53:17                                                        Vault                                                                    
GMC162L5                                                                   30/05/2015 09:30:36                                                        Vault                                                                    
GMC165L5                                                                   01/06/2015 01:55:07                                                        Vault                                                                    
GMC168L5                                                                   05/06/2015 19:08:37                                                        Slot                                                                     
GMC169L5                                                                   07/06/2015 06:31:29                                                        Slot                                                                     
GMC170L5                                                                   07/06/2015 22:16:22                                                        Slot                                                                     
GMC163L5                                                                   31/12/9999 23:59:59                                                        Slot                                                                     
GMC164L5                                                                   31/12/9999 23:59:59                                                        Slot

Is there any way I can have the actual slot ID and/or Vault name as the Location?

Any help will be appreciated. I am still learning my way with Powershell, so a working example would be really helpful

Thanks
M
mc1903
Enthusiast
Posts: 44
Liked: never
Joined: May 12, 2010 7:24 pm
Full Name: mc1903
Contact:

Re: v8 Tape Media Locations.

Post by mc1903 »

Hello,

Still struggling... Anyone able to help the fat kid out?

M
veremin
Product Manager
Posts: 20283
Liked: 2258 times
Joined: Oct 26, 2012 3:28 pm
Full Name: Vladimir Eremin
Contact:

Re: v8 Tape Media Locations.

Post by veremin »

I don't have an access to the console at the moment, so can't guarantee whether I'm not mistyping the parameters names, but there must be several identifier within location parameter. Something like Location.vaultID, Location.slotID, using which you can get information you're after.
rmeyer5
Influencer
Posts: 13
Liked: 1 time
Joined: May 28, 2015 8:48 am
Full Name: Rene Meyer
Location: Denmark
Contact:

Re: v8 Tape Media Locations.

Post by rmeyer5 » 1 person likes this post

(Get-VBRTapeMedium -Name "Tape Name").location

Gives the following result:
DriveId :
DriveAddress :
LibraryId : 92ecd965-1c0a-451a-bb85-83f1f83d353a
SlotAddress : 276
VaultId :
Type : Slot

Slotaddress start with 0, so you most likely need to add +1 to it to be same as the tape lib

So to get the correct Slot number use the following command:
((Get-VBRTapeMedium -Name "Tape Name").location.SlotAddress + 1)

So in your case, it would look like this:

Get-VBRTapeMedium | Where-Object { $_.IsExpired -eq $False -and $_.IsFree -eq $False} | Sort-Object {$_.ExpirationDate} | Select-Object -Property @{N="Barcode";E={$_.Barcode}}, @{N="Protected Until";E={$_.ExpirationDate}}, @{N="Location";E={$_.Location}}, @{N="SlotNo";E={$_.Location.SlotAddress +1}}


I hope it helps :)

- rené
Post Reply

Who is online

Users browsing this forum: No registered users and 13 guests