PowerShell script exchange
Post Reply
McClane
Expert
Posts: 106
Liked: 11 times
Joined: Jun 20, 2009 12:47 pm
Contact:

List Mediums imported and exported

Post by McClane »

Hi,

is there any way to get a list of recently exported mediums (either by a job or manually). So I have a list of tapes that I should expect in the I/E slots when I go to swap them.

Also, is there a way to list all imported tapes, so I can put them in the "Free Media" poo after import.

Thanks
veremin
Product Manager
Posts: 20415
Liked: 2302 times
Joined: Oct 26, 2012 3:28 pm
Full Name: Vladimir Eremin
Contact:

Re: List Mediums imported and exported

Post by veremin »

Do you have Veeam ONE installed? Doesn't this report provide the exact information you're looking for? Thanks.
McClane
Expert
Posts: 106
Liked: 11 times
Joined: Jun 20, 2009 12:47 pm
Contact:

Re: List Mediums imported and exported

Post by McClane »

No, we don't have Veeam One. And I need these informations for scripting, not as a printed report.
veremin
Product Manager
Posts: 20415
Liked: 2302 times
Joined: Oct 26, 2012 3:28 pm
Full Name: Vladimir Eremin
Contact:

Re: List Mediums imported and exported

Post by veremin »

A tape object has several properties, including Location and LastWriteTime. Media you're looking for will have None as Location.Type and recent date as a LastWriteTime.

Based on this knowledge, you can create a search query similar to the following:

Code: Select all

Get-VBRTapeMedium | where {($_.Location.Type -eq "None"") -and ($_.LastWritTime -ge (Get-Date).adddays(-$DaysToCheck))}
It's nothing but an rough example, so be aware to check it prior to sticking to it.

Thanks.
McClane
Expert
Posts: 106
Liked: 11 times
Joined: Jun 20, 2009 12:47 pm
Contact:

Re: List Mediums imported and exported

Post by McClane »

It's something but I hoped for something more reliable.

I also need a way to get a list of tapes that belong to a full baclup and all incrementals that are based on this full. This is needed if I want to move a full set. At the moment I don't see a practical way to get that information at al.
veremin
Product Manager
Posts: 20415
Liked: 2302 times
Joined: Oct 26, 2012 3:28 pm
Full Name: Vladimir Eremin
Contact:

Re: List Mediums imported and exported

Post by veremin »

I still think that Veeam ONE (our monitoring and reporting tool) is the most practical way here, since it has all the reports you're looking for.

Otherwise, you're left with the scripting and finding the combination of required search queries working more or less reliably for you.

As to moving imported tapes, check the following example:

Code: Select all

Asnp VeeamPSSnapin
$ImportedMediaPool = Get-VBRTapeMediaPool -Name "Imported"
$FreeMediaPool = Get-VBRTapeMediaPool -Name "Free"
$ImportedTapes = Get-VBRTapeMedium -MediaPool $MediaPool
Move-VBRTapeMedium -Medium $ImportedTapes -MediaPool $FreeMediaPool
Thanks.
McClane
Expert
Posts: 106
Liked: 11 times
Joined: Jun 20, 2009 12:47 pm
Contact:

Re: List Mediums imported and exported

Post by McClane »

I think that's a pool for foreign tapes, not for tapes that came out of the vault and are reinserted in the library.
veremin
Product Manager
Posts: 20415
Liked: 2302 times
Joined: Oct 26, 2012 3:28 pm
Full Name: Vladimir Eremin
Contact:

Re: List Mediums imported and exported

Post by veremin »

If tapes (that have been returned from a vault) have expired already, there will be re-used during next job cycle. So, there is no need to put them in free media pool. Or am I missing something here? Thanks.
McClane
Expert
Posts: 106
Liked: 11 times
Joined: Jun 20, 2009 12:47 pm
Contact:

Re: List Mediums imported and exported

Post by McClane »

I have different pools and want expired media to be used by any pool who needs media. Also to achieve a better rotation because media in the incremental pool are never written full.
Our former backup solution (IBM Tivoli) rotated the media frequently to prevent that some tapes are worn out and others are barely used at all.
veremin
Product Manager
Posts: 20415
Liked: 2302 times
Joined: Oct 26, 2012 3:28 pm
Full Name: Vladimir Eremin
Contact:

Re: List Mediums imported and exported

Post by veremin »

Tape mediums have IsExpired Boolean property that you can query for that exact purpose. Thanks.
McClane
Expert
Posts: 106
Liked: 11 times
Joined: Jun 20, 2009 12:47 pm
Contact:

Re: List Mediums imported and exported

Post by McClane »

I could use that, but I may have to filter out pools that have expired media in them (because they don't get exported ever). Would be nice if the Import-VBRTapeMedium command would log the imported tapes in it's properties (since it already logs something, but not the tapes). Same with the export command. It logs everything but the tape names. I can see in the job log, that exported media are logged somewhere. There is just no way to access that information, as far as I can see, by scripts.
With these scripts I want to track who, when and what is put in and out of the library. And also collect information which tapesets hold the full and incremental backups for a particular week (for documentation and disaster recovery procedures).
McClane
Expert
Posts: 106
Liked: 11 times
Joined: Jun 20, 2009 12:47 pm
Contact:

Re: List Mediums imported and exported

Post by McClane »

I found a (dirty) way to get the exported tapes out of the job logs.

Code: Select all

(Get-VBRSession -Last -Job $job).log | ? { $_.Title -like "*Exporting tape*" } | select -ExpandProperty title
Not a good way though, I will see what I can do with that.
McClane
Expert
Posts: 106
Liked: 11 times
Joined: Jun 20, 2009 12:47 pm
Contact:

Re: List Mediums imported and exported

Post by McClane » 1 person likes this post

This is how I extract the exported tape names and IO Slot number after a tape job run.

Code: Select all

(Get-VBRSession -Last -job $job).log | ? { $_.Title -like "*Exporting tape*" } | select -ExpandProperty title | select-string -Pattern "(\d{6}L\d).*port (\d{1,2})" |select @{Name="Band";Expression=$_.matches.groups[1].value}},@{Name="IOSlot";Expression={$_.matches.groups[2].value}}
Post Reply

Who is online

Users browsing this forum: No registered users and 9 guests