PowerShell script exchange
Post Reply
rleon
Enthusiast
Posts: 76
Liked: 10 times
Joined: Jun 15, 2017 8:10 am
Full Name: RLeon
Contact:

Changing individual Tape's Powershell "ExpirationDate" property

Post by rleon »

Hi all,

This is the problem I'm trying to solve:
Veeam Oracle RMAN Plugin jobs are not supported in Backup-to-Tape Jobs, but only in File-to-Tape Jobs, where you select the actual Backup-Files created inside the the Repository's RMAN Job's folder.
The problem with File-to-Tape Jobs, is that they don't support GFS-Media-Pools. Only Standard-Media-Pools are supported, which ultimately means you can't give RMAN Plugin backups GFS retention on tape.

To achieve Monthly-Fulls 3 months retention, and Yearly-Fulls 1 year retention on tape for RMAN Plugin Backups, I came up with the following workaround to simulate "GFS retention" in a Standard-Media-Pool, which seems to work:
Using Veeam Powershell commands "New-VBRTapeMediaPoolRetentionPolicy" and "Set-VBRTapeMediaPool",
I change the "-Period Months" property of the Standard-Media-Pool to 12 months (I.e.: 1 year) each year right before the Yearly Full File-to-Tape Job, then change it back to 3 months after the job completes, and keep it that way for the rest of the year.
Repeat this in a yearly-scheduled script.
Unlike in the console GUI, the Powershell command does not seem to offer you the option to "Apply new retention settings to all existing media?", which is fine because I don't want that anyway.
The aim is to only change the retention for Tapes created on a specific month once a year.

Now for the actual question:
In case someone clicks "Apply new retention settings to all existing media?" by mistake in the GUI, thereby changing all Tape retention in the Standard-Media-Pool to the same retention, and therefore ruining the carefully planed special retention for Yearly Full Tapes (as explained in the workaround above), is there a way to manually change the retention or expiry date of specific Tapes in a Standard-Media-Pool using Veeam Powershell commands?
In short: If someone changes the retention of all tapes in a Standard-Media-Pool to expire in 3 months. Is there a Veeam Powershell command to change SOME tapes in the pool to a different retention/expiry date, e.g., 1 year, which is different from the other Tapes in the same Pool?

Thanks!
rleon
Enthusiast
Posts: 76
Liked: 10 times
Joined: Jun 15, 2017 8:10 am
Full Name: RLeon
Contact:

Re: Changing individual Tape's Powershell "ExpirationDate" property

Post by rleon »

Code: Select all

PS C:\Users\administrator> Get-VBRTapeMedium -Name 'V20001L5'

Barcode                  : V20001L5
HasBarcode               : True
Free                     : 18296602624
Capacity                 : 31457280000
Location                 : Slot
PreviousLibraryId        :
PreviousMediaPoolId      :
SequenceNumber           : 1
ExpirationDate           : 8/2/2021 8:45:43 PM
MediaPoolId              : 37098838-6956-4ed8-8d1e-19710166567b
MediaSet                 : Media set # 2 7/5/2021 4:55 PM
LibraryId                : 12ab99ac-ee4b-49ca-9d7e-ec8745a8054d
...
...

Specifically, the question is about the possibility of changing a Tape's "ExpirationDate" property to some other date, without affecting other Tapes in the same pool.
The example above shows the "ExpirationDate" property of a Tape using Get-VBRTapeMedium.
soncscy
Veteran
Posts: 643
Liked: 312 times
Joined: Aug 04, 2019 2:57 pm
Full Name: Harvey
Contact:

Re: Changing individual Tape's Powershell "ExpirationDate" property

Post by soncscy » 1 person likes this post

Heya RLeon,

Not sure there's a way to do this without a manual DB edit, and I don't advise this. (Plus, I've understood this is explicitly not supported by Veeam). Below is just my take on it, maybe a Veeam employee knows more or can correct some of my observations.

The tape powershell system is a bit more "modern" as I see it than other elements in powershell in that it is much more careful about exposing the internal methods for the tape classes to users and it more appropriately sets its properties as "Read-Only" unless you access it through an appropriate end-point.

Basically, this boils down to if it's not directly supported by a cmdlet, you can't do it without digging into .NET methods or DBEdits. I was curious and took a peek at the .NET methods, but there isn't any direct one I could find that accepts just a tape medium ID as an input; you either update entire media pools, or nothing. There are some methods that look to update the database when a tape is maxed out or the media set closes on it, but it includes a lot of other elements and requires some uuids be created for such entries, so definitely don't pursue this as seems there must be some other linkage you need to worry about.

I'm not sure there's a good way to do what you're wanting except playing with manually setting Protect/Not Protect and managing GFS in some external mini-DB, then writing a simple watcher script that checks the tapes every day or something to validate your defined GFS periods and controls the protect vs unprotected state based on some date calculations from the DB. It doesn't need to be complex, you'd just basically take whatever logic you were planning to use for your existing home-brewed GFS schema, write the tape medium IDs of the used tapes per job session to your new database target, then run your logic on that datasource and use it to protect/unprotect tapes.

Since you're home-rolling GFS for File to Tape anyways, I actually don't think this involves that much work. You could even just use a simple CSV file if you don't want to deal with SQL.

Hope it helps, and maybe there's a better solution I'm overlooking, but as I see it, if you already have a GFS logic worked out, you can probably crank this out in an afternoon.
rleon
Enthusiast
Posts: 76
Liked: 10 times
Joined: Jun 15, 2017 8:10 am
Full Name: RLeon
Contact:

Re: Changing individual Tape's Powershell "ExpirationDate" property

Post by rleon »

Hi soncscy,

Thanks for your deep insight.
Yes, I see how using Enable-VBRTapeProtection to Protect/Unprotect Tapes + a simple CSV file with a Barcode-List can be put together to effectively "GFS-tify" a Standard-Media-Pool as a 2nd workaround. A better one than what I have now, even.
Hopefully someone from Veeam has something even better, like... I donno, maybe either:
  • Make Backup-to-Tape Jobs include Oracle RMAN Plugin backups
  • Allow File-to-Tape Jobs to write to GFS-Media-Pools
  • Allow GFS retention in Standard-Media-Pools (In which case, might as well just scrap Standard-Media-Pools altogether and just have GFS-Media-Pools :))
oleg.feoktistov
Veeam Software
Posts: 2010
Liked: 670 times
Joined: Sep 25, 2019 10:32 am
Full Name: Oleg Feoktistov
Contact:

Re: Changing individual Tape's Powershell "ExpirationDate" property

Post by oleg.feoktistov »

Hi rleaon,

If providing .NET tweaks to the features not supported in powershell, some core logic is implied to be in place, which is also usually reflected in the UI or registry keys. When it comes to your 3 last questions, these are not the UI features, nor can I find any registry key to turn on their support. There aren't any internal test methods implemented as well. I did find the method to set expiration date on a single tape medium, but it doesn't seems to work at all, so I cannot recommend it. So, I think the way Harvey came up with could be a workaround here.

Thanks,
Oleg
Post Reply

Who is online

Users browsing this forum: No registered users and 12 guests