Discussions related to exporting backups to tape and backing up directly to tape.
Post Reply
mcafeej
Influencer
Posts: 19
Liked: 3 times
Joined: Nov 02, 2011 4:03 pm
Full Name: Jesse McAfee
Contact:

Expired Media Report

Post by mcafeej »

I am using a GFS backup rotation on tape and I have three media pools setup. I have a Daily with a retention of 6 days, Weekly with a retention of 4 weeks and a Monthly with a retention of 12 months. After the backup is complete the tapes are moved offsite until the retention schedule is up, however I don't see any reports or any easy way of telling what tapes are expired and ready to return to the tape library.

I have a 8 slot Quantum Superloader 3 LTO 5 so my onsite media storage is slim inside the library. When I was using BackupExec it generated a report of the media that is scheduled to return from the vault or offsite storage. My Veeam version is 7.0.0.839

What is our options with Veeam?
veremin
Product Manager
Posts: 20415
Liked: 2302 times
Joined: Oct 26, 2012 3:28 pm
Full Name: Vladimir Eremin
Contact:

Re: Expired Media Report

Post by veremin »

HI, Jesse, I believe you can achieve what you're after with little PS scripting. The following script will list tape medium that have expired protection period:

Code: Select all

asnp VeeamPSSnapin
Get-VBRTapeMedium | Where-Object { $_.IsOverwriteProtectionPeriodOver() -eq $True}
Thanks.
mcafeej
Influencer
Posts: 19
Liked: 3 times
Joined: Nov 02, 2011 4:03 pm
Full Name: Jesse McAfee
Contact:

Re: Expired Media Report

Post by mcafeej »

That did work, thanks for the help!

Is there any future enhancements that might include reports of expired media that is scheduled to return to library sent via email? I really think that would be a great feature, especially for those of us who have rather large rotation of tapes.

Also it would be a great feature to have the ability to specify vault(s) for offsite storage after a tape is exported. Especially when dealing with external auditors you can show them where your tapes are located without keeping manual log sheets.
Vitaliy S.
VP, Product Management
Posts: 27377
Liked: 2800 times
Joined: Mar 30, 2009 9:13 am
Full Name: Vitaliy Safarov
Contact:

Re: Expired Media Report

Post by Vitaliy S. »

Hi Jesse,

Yes, we are planning to enhance our reporting functionality in terms of tape support. This report should be part of Veeam ONE solution.

BTW, if you already have a report (or you want to see any other report) that does exactly what you want, can you please share it with us?

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

Re: Expired Media Report

Post by veremin »

As to tape vault feature, we're currently working on it. According to the plan, it should be delivered in one of the next product releases. Thanks.
mcafeej
Influencer
Posts: 19
Liked: 3 times
Joined: Nov 02, 2011 4:03 pm
Full Name: Jesse McAfee
Contact:

Re: Expired Media Report

Post by mcafeej »

This is what I have come up with that works for me, until Veeam provides some tape reporting in future releases.

I saved this script on my backup server and run a scheduled task daily at 8:00 AM so I can prepare any tapes that needs to be brought back from our remote tape vault.
This script will generate a list of tapes by Name (Which is also the barcode on my system) that has expired and is Offline (Not in tape library) and email it to you, please feel free to edit this script as you see fit for your use.

Change the variables in the script to match your smtp server, from, reply and to email address.
Expired Media.ps1

Code: Select all

asnp VeeamPSSnapin

#SMTP server name
$smtpServer = "exchange.domain.local"

#Creating a Mail object
$msg = new-object Net.Mail.MailMessage

#Creating SMTP server object
$smtp = new-object Net.Mail.SmtpClient($smtpServer)

#Email structure
$msg.From = "backup@domain.local"
$msg.ReplyTo = "backup@domain.local"
$msg.To.Add("technicians@domain.local")
$msg.subject = "Backup Server - Expired Media Report"
$msg.body = Get-VBRTapeMedium | Where-Object { $_.IsOverwriteProtectionPeriodOver() -eq $True -and $_.LocationEx -like "Offline"} | Format-Table -Property Name | out-string

#Sending email
$smtp.Send($msg)
veremin
Product Manager
Posts: 20415
Liked: 2302 times
Joined: Oct 26, 2012 3:28 pm
Full Name: Vladimir Eremin
Contact:

Re: Expired Media Report

Post by veremin »

Hi, Jesse, as far as I know, the locationEX parameter indicates medium previous location, the place where the given tape has been stored previously. Thus, I suggest using $_.IsOnline parameter, instead, as it gives explicit information about cassette state.

Code: Select all

Where-Object {($_.IsOverwriteProtectionPeriodOver() -eq $True) -and ($_.IsOnline -eq $False)}
Thanks.
mcafeej
Influencer
Posts: 19
Liked: 3 times
Joined: Nov 02, 2011 4:03 pm
Full Name: Jesse McAfee
Contact:

Re: Expired Media Report

Post by mcafeej »

Thank you very much for the clarification, I have updated my code to match your recommendation.
veremin
Product Manager
Posts: 20415
Liked: 2302 times
Joined: Oct 26, 2012 3:28 pm
Full Name: Vladimir Eremin
Contact:

Re: Expired Media Report

Post by veremin »

You can get all the parameters tape medium has via Get-Member commandlet; kind of useful thing when you don't know for sure what settings or parameters the given object has.

Anyway, glad to hear my input was useful. Let us know, if any other questions arise.

Thanks.
squirtleuk
Novice
Posts: 7
Liked: never
Joined: Jun 09, 2015 1:46 pm
Full Name: Alan Bailey
Contact:

Re: Expired Media Report

Post by squirtleuk »

I am interested in using this script, but I'm unable to get this to work. I'm new to Powershell, but I list some of the errors below from the command again listed below:

Code: Select all

Get-VBRTapeMedium | Where-Object {($_.IsOverwriteProtectionPeriodOver() -eq $True) -and ($_.IsOnline -eq $False)}

Method invocation failed because [Veeam.Backup.PowerShell.Infos.VBRTapeMedium] doesn't contain a method named 'IsOverwriteProtectionPeriodOver'.
At line:1 char:36
+ Get-VBRTapeMedium | Where-Object { $_.IsOverwriteProtectionPeriodOver() -eq $Tru ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : InvalidOperation: (:) [], RuntimeException
    + FullyQualifiedErrorId : MethodNotFound
 
Method invocation failed because [Veeam.Backup.PowerShell.Infos.VBRTapeMedium] doesn't contain a method named 'IsOverwriteProtectionPeriodOver'.
At line:1 char:36
+ Get-VBRTapeMedium | Where-Object { $_.IsOverwriteProtectionPeriodOver() -eq $Tru ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : InvalidOperation: (:) [], RuntimeException
    + FullyQualifiedErrorId : MethodNotFound
The errors continue for several pages. Any assistance would be appreciated.
veremin
Product Manager
Posts: 20415
Liked: 2302 times
Joined: Oct 26, 2012 3:28 pm
Full Name: Vladimir Eremin
Contact:

Re: Expired Media Report

Post by veremin »

In order to get expired media, use the following script:

Code: Select all

Get-VBRTapemedium | where {$_.IsExpired -eq $True}
Thanks.
squirtleuk
Novice
Posts: 7
Liked: never
Joined: Jun 09, 2015 1:46 pm
Full Name: Alan Bailey
Contact:

Re: Expired Media Report

Post by squirtleuk »

Thank you that's great, can you filter the output to list just the tape names?
veremin
Product Manager
Posts: 20415
Liked: 2302 times
Joined: Oct 26, 2012 3:28 pm
Full Name: Vladimir Eremin
Contact:

Re: Expired Media Report

Post by veremin »

Sure,

Code: Select all

Get-VBRTapemedium | where {$_.IsExpired -eq $True} | select Name
Thanks.
squirtleuk
Novice
Posts: 7
Liked: never
Joined: Jun 09, 2015 1:46 pm
Full Name: Alan Bailey
Contact:

Re: Expired Media Report

Post by squirtleuk »

Again thanks. I also wish to filter tapes expired, but out of the library (i.e. with a Location of offline). I tried the following, but it shows no results:

Get-VBRTapemedium | where {($_.IsExpired -eq $True) -and ($_.IsOnline -eq $False)}
veremin
Product Manager
Posts: 20415
Liked: 2302 times
Joined: Oct 26, 2012 3:28 pm
Full Name: Vladimir Eremin
Contact:

Re: Expired Media Report

Post by veremin »

What about this one-liner?

Code: Select all

Get-VBRTapemedium | where {($_.IsExpired -eq $True) -and ($_.location.type -eq "Offline")} | select Name
squirtleuk
Novice
Posts: 7
Liked: never
Joined: Jun 09, 2015 1:46 pm
Full Name: Alan Bailey
Contact:

Re: Expired Media Report

Post by squirtleuk »

Sorry that still comes back with no results, but i know they should be two tapes which expired this morning. Currently they are out of the library.
squirtleuk
Novice
Posts: 7
Liked: never
Joined: Jun 09, 2015 1:46 pm
Full Name: Alan Bailey
Contact:

Re: Expired Media Report

Post by squirtleuk »

The result is still empty, but I know two tapes expired this morning. They are not currently in the library.

Thank you for all your assistance so far.
veremin
Product Manager
Posts: 20415
Liked: 2302 times
Joined: Oct 26, 2012 3:28 pm
Full Name: Vladimir Eremin
Contact:

Re: Expired Media Report

Post by veremin »

What about this script; it should list names of tapes that are not located inside slot, nor inside drive. In other words, it will list mediums that are offline or located inside vault.

Code: Select all

Get-VBRTapemedium | where {($_.IsExpired -eq $True) -and ($_.location.type -ne "Slot") -and ($_.location.type -ne "Drive")} | select Name
Thanks.
Tarqy
Service Provider
Posts: 42
Liked: 5 times
Joined: Aug 08, 2014 1:51 pm
Full Name: Barry Knox
Contact:

Re: Expired Media Report

Post by Tarqy »

Sorry to bump an old thread but is this reporting functionality still not part of the product and is a script required?

I want to be able to generate a list of expired vault media to bring back from storage and have this sent via email each morning to our tape storage provider.
VMCE
veremin
Product Manager
Posts: 20415
Liked: 2302 times
Joined: Oct 26, 2012 3:28 pm
Full Name: Vladimir Eremin
Contact:

Re: Expired Media Report

Post by veremin » 1 person likes this post

Sorry to bump an old thread but is this reporting functionality still not part of the product and is a script required?
It's a part of Availability Suite. Take a look at Tape Vaults report. Thanks.
Tarqy
Service Provider
Posts: 42
Liked: 5 times
Joined: Aug 08, 2014 1:51 pm
Full Name: Barry Knox
Contact:

Re: Expired Media Report

Post by Tarqy »

and if you don't have availability suite?
VMCE
veremin
Product Manager
Posts: 20415
Liked: 2302 times
Joined: Oct 26, 2012 3:28 pm
Full Name: Vladimir Eremin
Contact:

Re: Expired Media Report

Post by veremin »

Then, use "Vaults" node to check what mediums are already expired and can be taken back to library. Or leverage the script, instead, to obtain this information automatically.
Tarqy
Service Provider
Posts: 42
Liked: 5 times
Joined: Aug 08, 2014 1:51 pm
Full Name: Barry Knox
Contact:

Re: Expired Media Report

Post by Tarqy »

Will this functionality ever be part of B&R? I can appreciate you have a report in Veeam ONE but surely this functionality should not be limited to having to purchase an additional product?
VMCE
Vitaliy S.
VP, Product Management
Posts: 27377
Liked: 2800 times
Joined: Mar 30, 2009 9:13 am
Full Name: Vitaliy Safarov
Contact:

Re: Expired Media Report

Post by Vitaliy S. »

Doubt it, all predefined reports on backup infrastructure as well as virtual infrastructure will stay in Veeam ONE (part of Availability Suite). If you don't have this product installed, then PowerShell should be a way to go. Thanks!
Tarqy
Service Provider
Posts: 42
Liked: 5 times
Joined: Aug 08, 2014 1:51 pm
Full Name: Barry Knox
Contact:

Re: Expired Media Report

Post by Tarqy »

Since you're the product manager I'd like to highlight my concern about this then.

Veeam B&R has tape support but its severely lacking when it comes to tape management and this functionality really needs to be something that is standard without any additional product. I know we are calling it a "report" but its actually a critical part of tape management and as such I would have thought that should be part of B&R.

At the end of the day its simply a list of tapes that either need to go offsite or be returned when they have expired, Its really no different to the backup failure notifications and these don't require an additional product.

I appreciate you can view the vault and look up this information manually but that is far from ideal. The customer I'm currently working with uses a 3rd party provider for tape storage and that 3rd party simply want a list of tapes they should be returning to site each day.

I'll stick with the script as it does the same thing but I personal think its the wrong decision. Veeam is great because its easy to use and for the most part just works but having to create power shell scripts to gather what should be standard information falls short of that ethos.
VMCE
Vitaliy S.
VP, Product Management
Posts: 27377
Liked: 2800 times
Joined: Mar 30, 2009 9:13 am
Full Name: Vitaliy Safarov
Contact:

Re: Expired Media Report

Post by Vitaliy S. » 1 person likes this post

Hi Barry,

Thanks for your feedback on this. I do agree that there might be some features missing, that's why we have made lots of improvements for tape management in the upcoming version of Veeam B&R.

If you look through these forums, you will notice that lots of people are asking for different tape reports. We do monitor these requests and then make predefined templates for each and every request. Currently Veeam ONE covers all "core" tape reporting scenarios, moreover, we are adding 3 additional reports for tape management to support new functionality of v9.

Veeam B&R is not a reporting tool, but it does provide a way to get the required information via PowerShell, Windows Event log, Enterprise Manager and email notifications. If automatic report generation, report customization for specific needs is required, then a tool which was specifically built for these purposes (100+ predefined reports) should be used.

Hope this makes sense. Thanks!
nullifi
Influencer
Posts: 23
Liked: 5 times
Joined: Aug 05, 2015 1:41 pm
Full Name: Jason Taylor
Contact:

Re: Expired Media Report

Post by nullifi »

Tarqy wrote:I want to be able to generate a list of expired vault media to bring back from storage and have this sent via email each morning to our tape storage provider.
I created a script to do that, if you're interested. For my scenario, I request a particular amount of expired tapes and then sit them on the shelf where they will eventually be put in the library. When I just mark a tape in the off site vault as free it still remains in that vault until Veeam sees it in the library. I didn't want that so I created a new vault for on site free tapes. The script will move the requested tapes to that vault then mark them as free. I have this set to be executed daily via a scheduled task in the early morning.

Code: Select all

Add-PSSnapin VeeamPSSnapin

# Email recipients
$Recipients = @(
"one@example.com",
"two@example.com"
)

# Vault ID of the off site vault to request tapes from
# Find via Get-VBRTapeVault | select name, id
$OffsiteVaultId = '676a551a-c262-43d7-bbd0-d017cb51bea3'

# Free media vault and free media pool ID's
# Find via: Get-VBRTapeMediaPool | select name, id
# and Get-VBRTapeVault | select name, id
$FreeVault = Get-VBRTapeVault -Id '8fa019ac-6fdd-43f8-b992-dcc5e3028363'
$FreePool = Get-VBRTapeMediaPool -Id '759d84f2-83bb-48e0-abcb-e55d3ad500b7'

# Get list of expired tapes
$ExpiredTapes = Get-VBRTapeMedium | Where-Object {
    $_.IsExpired -eq $True -and $_.Location.VaultId -eq $OffsiteVaultId
} | Sort Name | Select-Object -First 10

# Move expired tapes to the Free Vault
$ExpiredTapes | ForEach-Object {Move-VBRTapeMedium -Medium $_ -Vault $FreeVault}

# Then move to free media pool
$ExpiredTapes | ForEach-Object {Move-VBRTapeMedium -Medium $_ -MediaPool $FreePool}

$Body = "Tape request:`n`n"

$ExpiredTapes | Sort | ForEach-Object { $Body += "$($_.name)`n" }

$Body += "`nTotal Tapes: $($ExpiredTapes.Count)"

Send-MailMessage -To $Recipients -From 'TapeRequest@example.com' -Subject "Tape Request for $(Get-Date -UFormat "%m/%d/%Y")" -SmtpServer 'smtp.example.com' -Body $Body
Tarqy
Service Provider
Posts: 42
Liked: 5 times
Joined: Aug 08, 2014 1:51 pm
Full Name: Barry Knox
Contact:

Re: Expired Media Report

Post by Tarqy »

v.Eremin wrote:What about this script; it should list names of tapes that are not located inside slot, nor inside drive. In other words, it will list mediums that are offline or located inside vault.

Code: Select all

Get-VBRTapemedium | where {($_.IsExpired -eq $True) -and ($_.location.type -ne "Slot") -and ($_.location.type -ne "Drive")} | select Name
Thanks.
This script is working and provides a list of tapes but I need to take into account that cannot return some expired tapes until the rest of the weekly chain has expired, Is anyone able to give me an idea of how to account for this?
VMCE
cloudy
Novice
Posts: 9
Liked: 13 times
Joined: Mar 16, 2016 8:42 pm
Contact:

Re: Expired Media Report

Post by cloudy »

Perhaps you could evaluate the media set expiration date:

Code: Select all

$date = (get-date -format MM/dd/yy)
$time = (get-date -format HH:mm:ss)
Get-VBRTapemedium | where {($_.ExpirationDate -gt ($date+" "+$time) -and ($_.IsExpired -eq $True) -and ($_.location.type -ne "Slot") -and ($_.location.type -ne "Drive")} | select Name
I'm using the below script which I wrote to tell me how many tapes need to be exported and how many tapes I have available for import along with the bardcode of the tape. This could be easily modified to tell you any additional info. I only have one vault so you'll need to modify the logic to meet your needs. The report is an html formatted email.

Code: Select all

asnp VeeamPSSNapin
$date = (get-date -format MM/dd/yy)
$time = (get-date -format HH:mm:ss)

#find number of tapes free, available to import into library
$tapeList = Get-VBRTapeMedium | where {$_.IsExpired -eq $true -and $_.Location -like "Vault"} | Sort-Object {$_.barcode} #|format-table -autosize -property {$_.barcode}, {$_.isexpired}, {$_.expirationdate} #Get expired tapes

#display message if no tapes are available for import
if ($tapeList.count -eq 0) {
    $tapeList = New-Object psobject
    $tapeList| add-member noteproperty barcode "Not tapes available for import"
}
#find number of tapes to export, tapes already written to
$tapes = Get-VBRTapeMedium | where {($_.ExpirationDate -gt ($date+" "+$time) -and $_.Location -like "Slot" -or $_.Location -like "Drive")}| Sort-Object {$_.barcode}

$head=@"
<style>
@charset "UTF-8";

#content {
width:75%;
border:0px solid #005a99;
padding-left:50px;
}
 
h2 {
	color:#0888d8;
}

h3 {
	color:#0888d8;
	font-size:x-large;
}

p {
	font-size:large;
	font-weight: bold;
	padding-bottom: 0px;
}

.red {
	color:#cc0000;
	font-size:large;
	font-weight: bold;
	padding-bottom: 0px;
}

.green {
	color:#4caf50;
	font-size:large;
	font-weight: bold;
	padding-bottom: 0px;
}

table {
    border-collapse: collapse;
    width: 100%;
}

th, td {
    text-align: left;
    padding: 8px;
}

tr:nth-child(odd){background-color: #f2f2f2}

th {
    background-color: #4caf50;
    color: white;
}

</style>
"@

$htmlbody = $tapeList | Select @{Name="Tape Barcode";Expression={$_.Barcode}},@{Name="Expiration Date";Expression={$_.ExpirationDate}},@{Name="Expired Status";Expression={$_.IsExpired}} | ConvertTo-HTML -Head $head -PreContent "<div id=""content"" class=""transparent""><H2>Veeam Backup Report - Import Tape List $($date)</H2><div class=""red"">Number of tapes to export: $($tapes.count)</div><div class=""green"">Number of tapes available for import: $($tapeList.count)</div><h3>Available tapes for import:</h3>" -PostContent "</div>"| out-string

#use as sample output file
#$htmlbody | Out-File -FilePath ".\html.htm"

$emailSender = "<sender_email_address>"
[string[]]$emailRecipients = "<email_recipients>" #comma delimited: "user1@example.com","user2@example.com"
$emailSubject = "Veeam Backup Report - Import Tape List $(date)"
$smtpServer = "<smtp_server>"
Send-MailMessage -From $emailSender -Subject "$($emailSubject)" -To $emailRecipients -Body $htmlbody -BodyAsHtml -SmtpServer $smtpServer
To use change the following variable values:
$emailSender
$emailRecipients
$smtpServer
Dima P.
Product Manager
Posts: 14726
Liked: 1707 times
Joined: Feb 04, 2013 2:07 pm
Full Name: Dmitry Popov
Location: Prague
Contact:

Re: Expired Media Report

Post by Dima P. »

Hi cloudy,

This might be a bit outdated question, but have you seen the latest Tape Media Retention Period report from Veeam One v9? It should provide a great overview of the expired media and it's location, so worth checking.
Post Reply

Who is online

Users browsing this forum: No registered users and 6 guests