List Mediums imported and exported

PowerShell script exchange

List Mediums imported and exported

Veeam Logoby McClane » Thu Apr 28, 2016 10:28 am

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
McClane
Enthusiast
 
Posts: 91
Liked: 10 times
Joined: Sat Jun 20, 2009 12:47 pm

Re: List Mediums imported and exported

Veeam Logoby v.Eremin » Thu Apr 28, 2016 10:33 am

Do you have Veeam ONE installed? Doesn't this report provide the exact information you're looking for? Thanks.
v.Eremin
Veeam Software
 
Posts: 13296
Liked: 974 times
Joined: Fri Oct 26, 2012 3:28 pm
Full Name: Vladimir Eremin

Re: List Mediums imported and exported

Veeam Logoby McClane » Thu Apr 28, 2016 10:34 am

No, we don't have Veeam One. And I need these informations for scripting, not as a printed report.
McClane
Enthusiast
 
Posts: 91
Liked: 10 times
Joined: Sat Jun 20, 2009 12:47 pm

Re: List Mediums imported and exported

Veeam Logoby v.Eremin » Thu Apr 28, 2016 11:09 am

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.
v.Eremin
Veeam Software
 
Posts: 13296
Liked: 974 times
Joined: Fri Oct 26, 2012 3:28 pm
Full Name: Vladimir Eremin

Re: List Mediums imported and exported

Veeam Logoby McClane » Thu Apr 28, 2016 1:53 pm

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.
McClane
Enthusiast
 
Posts: 91
Liked: 10 times
Joined: Sat Jun 20, 2009 12:47 pm

Re: List Mediums imported and exported

Veeam Logoby v.Eremin » Fri Apr 29, 2016 8:20 am

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.
v.Eremin
Veeam Software
 
Posts: 13296
Liked: 974 times
Joined: Fri Oct 26, 2012 3:28 pm
Full Name: Vladimir Eremin

Re: List Mediums imported and exported

Veeam Logoby McClane » Fri Apr 29, 2016 9:27 am

I think that's a pool for foreign tapes, not for tapes that came out of the vault and are reinserted in the library.
McClane
Enthusiast
 
Posts: 91
Liked: 10 times
Joined: Sat Jun 20, 2009 12:47 pm

Re: List Mediums imported and exported

Veeam Logoby v.Eremin » Fri Apr 29, 2016 9:55 am

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.
v.Eremin
Veeam Software
 
Posts: 13296
Liked: 974 times
Joined: Fri Oct 26, 2012 3:28 pm
Full Name: Vladimir Eremin

Re: List Mediums imported and exported

Veeam Logoby McClane » Fri Apr 29, 2016 10:02 am

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.
McClane
Enthusiast
 
Posts: 91
Liked: 10 times
Joined: Sat Jun 20, 2009 12:47 pm

Re: List Mediums imported and exported

Veeam Logoby v.Eremin » Fri Apr 29, 2016 10:17 am

Tape mediums have IsExpired Boolean property that you can query for that exact purpose. Thanks.
v.Eremin
Veeam Software
 
Posts: 13296
Liked: 974 times
Joined: Fri Oct 26, 2012 3:28 pm
Full Name: Vladimir Eremin

Re: List Mediums imported and exported

Veeam Logoby McClane » Fri Apr 29, 2016 10:29 am

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
Enthusiast
 
Posts: 91
Liked: 10 times
Joined: Sat Jun 20, 2009 12:47 pm

Re: List Mediums imported and exported

Veeam Logoby McClane » Wed May 04, 2016 6:34 am

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
Enthusiast
 
Posts: 91
Liked: 10 times
Joined: Sat Jun 20, 2009 12:47 pm

Re: List Mediums imported and exported

Veeam Logoby McClane » Tue Jul 05, 2016 8:33 am 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}}
McClane
Enthusiast
 
Posts: 91
Liked: 10 times
Joined: Sat Jun 20, 2009 12:47 pm


Return to PowerShell



Who is online

Users browsing this forum: No registered users and 5 guests