-
- Expert
- Posts: 116
- Liked: 14 times
- Joined: Nov 26, 2013 6:13 pm
- Full Name: Michael Cook
- Contact:
Write latest active full produced .vbk to tape
Hello all,
I hoping someone has already written a script for this that they could share or it is an easy enough request to create a script for me. I'd like to have a script that will write the latest active full produced .vbk to tape. I would then want to schedule this for the day after my active full is written to disk. As I am using reverse incremental mode with a monthly active full does this seem possible? I guess having a better understanding of the files on disk after the active full would assist in my file selection criteria. If I understand it correctly, directly after the active full would I have the .vbk for that day as part of my reverse incremental chain as well as a second copy of the .vbk that is the active full. Which one is produced first? I am thinking this would help select the active full based on time of creation. If this is not possible then I could simply run the script one day later where the active full is guaranteed to be the second newest .vbk.
Also if I went this route would Veeam B&R still be aware of the individual VMs that are backed up to tape allowing the expansion of the backups on tape section to show the individual VMs or would it then only expand to show the .vbk?
Any help would be greatly appreciated.
I hoping someone has already written a script for this that they could share or it is an easy enough request to create a script for me. I'd like to have a script that will write the latest active full produced .vbk to tape. I would then want to schedule this for the day after my active full is written to disk. As I am using reverse incremental mode with a monthly active full does this seem possible? I guess having a better understanding of the files on disk after the active full would assist in my file selection criteria. If I understand it correctly, directly after the active full would I have the .vbk for that day as part of my reverse incremental chain as well as a second copy of the .vbk that is the active full. Which one is produced first? I am thinking this would help select the active full based on time of creation. If this is not possible then I could simply run the script one day later where the active full is guaranteed to be the second newest .vbk.
Also if I went this route would Veeam B&R still be aware of the individual VMs that are backed up to tape allowing the expansion of the backups on tape section to show the individual VMs or would it then only expand to show the .vbk?
Any help would be greatly appreciated.
-
- Expert
- Posts: 116
- Liked: 14 times
- Joined: Nov 26, 2013 6:13 pm
- Full Name: Michael Cook
- Contact:
Re: Write latest active full produced .vbk to tape
I have this so far which selects the second most recent .vbk which if run two days after the active full would be the .vbk produced by the active full. I am going to try to use this as the selection for the tape job.
Code: Select all
Add-PSSnapin VeeamPSSnapin
$ProdBackupDir = "D:\Backup\Prod Backup Job\"
$ProdBackupDirVbks = dir $ProdBackupDir -Filter "*.vbk"
$SecondLatestVbk = $ProdBackupDirVbks | group directory | foreach {@($_.group | sort {[datetime]$_.creationtime} -desc)[1]}
$FilePath = $SecondLatestVbk.DirectoryName
$FileName = $SecondLatestVbk.Name
Write-Host $FileName
-
- Expert
- Posts: 116
- Liked: 14 times
- Joined: Nov 26, 2013 6:13 pm
- Full Name: Michael Cook
- Contact:
Re: Write latest active full produced .vbk to tape
My selection code was derived from this post: http://forums.veeam.com/post125443.html ... pe#p125443
-
- Expert
- Posts: 116
- Liked: 14 times
- Joined: Nov 26, 2013 6:13 pm
- Full Name: Michael Cook
- Contact:
Re: Write latest active full produced .vbk to tape
I believe what I have below will work. Can anyone please confirm or advise if there is an easier way of accomplishing this?
Code: Select all
Add-PSSnapin VeeamPSSnapin
$ProdBackupDir = "D:\Backup\Prod Backup Job\"
$ProdBackupDirVbks = dir $ProdBackupDir -Filter "*.vbk"
$SecondLatestVbk = $ProdBackupDirVbks | group directory | foreach {@($_.group | sort {[datetime]$_.creationtime} -desc)[1]}
$FilePath = $SecondLatestVbk.DirectoryName
$FileName = $SecondLatestVbk.Name
$VBRFilePath = $FilePath + "\" + $FileName
Write-Host $FileName
Write-Host $VBRFilePath
$ActiveFullObject = New-VBRFileToTapeObject -Path $VBRFilePath
Set-VBRFileToTapeJob -Job LatestProdVBK -Object $ActiveFullObject
Start-VBRJob LatestProdVBK
-
- Expert
- Posts: 116
- Liked: 14 times
- Joined: Nov 26, 2013 6:13 pm
- Full Name: Michael Cook
- Contact:
Re: Write latest active full produced .vbk to tape
I have now removed the write-host lines, as they were only for my testing of variables, as well as the start-vbrjob line. I have then added this as a pre-job script so that it modifies the file selected right before the file to tape job.
-
- Expert
- Posts: 116
- Liked: 14 times
- Joined: Nov 26, 2013 6:13 pm
- Full Name: Michael Cook
- Contact:
Re: Write latest active full produced .vbk to tape
So the VBRFileToTapeJob works but Veeam is not aware that the individual VMs were backed up using this method which would make restoration very dependent on constant documentation of jobs. In case any has been following this thread I changed it to the script below in hopes that recreating the job will cause the backup job to only write the latest to tape.
Code: Select all
Add-PSSnapin VeeamPSSnapin
$JobName = "Prod Backup to Tape Job"
$JobDesc = "Prod Tape Job created by Script"
$BackupObject = Get-VBRJob -Name "Prod Backup Job"
$MediaPool = "Prod"
$MonthlyOptions = New-VBRMonthlyOptions -Period 23:59 -DayNumberInMonth Third -DayOfWeek Sunday
$ScheduleOptions = New-VBRBackupToTapeScheduleOptions -Type Monthly -MonthlyOptions $MonthlyOptions -Enabled
Remove-VBRJob -Job $JobName
Add-VBRBackupToTapeJob -Name $JobName -Description $JobDesc -EjectCurrentMedium -FullBackupMediaPool Prod -WaitForBackupJob -WaitPeriod 776 -ScheduleOptions $ScheduleOptions -Object $BackupObject -ProcessIncrementalBackup:$false
-
- Expert
- Posts: 116
- Liked: 14 times
- Joined: Nov 26, 2013 6:13 pm
- Full Name: Michael Cook
- Contact:
Re: Write latest active full produced .vbk to tape
No luck. It processes both my last active full and the most recent reverse incremental produced .vbk. I can't find the option to only process the most recent for a new tape job.
-
- Product Manager
- Posts: 20400
- Liked: 2298 times
- Joined: Oct 26, 2012 3:28 pm
- Full Name: Vladimir Eremin
- Contact:
Re: Write latest active full produced .vbk to tape
Yep, the re-creation of a backup to tape job wouldn't make a job copy only the latest .vbk file. The options you have are combination of files to tape job and scripting and forward forever mode with virtual synthesized full backup.
Thanks.
Thanks.
-
- Enthusiast
- Posts: 92
- Liked: 18 times
- Joined: May 21, 2014 12:15 pm
- Full Name: Remko de Koning
- Contact:
Re: Write latest active full produced .vbk to tape
Hi, I would like to jump in as well if that's ok?
I have to say that I am completely new to scripting with Veeam but I think that my goal is the same as the the topic starter. I wasn't able to find my answer in the GUI of B&R so perhaps powershell has an answer to my problem.
I have reversed incrementals and one real full each month. I want to put one full to tape each month. It doesn't really matter which one. Right now it puts both full's on tape which consumes my tapes twice as fast.
What can I do to put only one full on tape?
My retention period on disk is one month so each month contains two full's. One real and one synthetic.
I have to say that I am completely new to scripting with Veeam but I think that my goal is the same as the the topic starter. I wasn't able to find my answer in the GUI of B&R so perhaps powershell has an answer to my problem.
I have reversed incrementals and one real full each month. I want to put one full to tape each month. It doesn't really matter which one. Right now it puts both full's on tape which consumes my tapes twice as fast.
What can I do to put only one full on tape?
My retention period on disk is one month so each month contains two full's. One real and one synthetic.
-
- Expert
- Posts: 116
- Liked: 14 times
- Joined: Nov 26, 2013 6:13 pm
- Full Name: Michael Cook
- Contact:
Re: Write latest active full produced .vbk to tape
Something that has worked for me but is clunky is simply putting in enough tapes for one of the .vbk and then cancelling the tape job once it finishes sending the first .vbk to tape. This way if I run it at least one day after the active full I end up with the tape job showing as failing but I have the active full on tape and Veeam is aware of which VMs are protected on tape.
-
- Product Manager
- Posts: 20400
- Liked: 2298 times
- Joined: Oct 26, 2012 3:28 pm
- Full Name: Vladimir Eremin
- Contact:
Re: Write latest active full produced .vbk to tape
Add a file to tape job, create a script that checks corresponding backup folder, find the latest .vbk, and sets it as a source for the said job. Then, schedule this script using Windows Task Scheduler to take place once a month. Thanks.What can I do to put only one full on tape?
-
- Enthusiast
- Posts: 92
- Liked: 18 times
- Joined: May 21, 2014 12:15 pm
- Full Name: Remko de Koning
- Contact:
Re: Write latest active full produced .vbk to tape
Are there any examples available? As said, I am new to this and have zero experience with the scripting of Veeam. What would be a good place to start getting familiar with this?
Good to see this problem can be solved.
Good to see this problem can be solved.
-
- Product Manager
- Posts: 20400
- Liked: 2298 times
- Joined: Oct 26, 2012 3:28 pm
- Full Name: Vladimir Eremin
- Contact:
Re: Write latest active full produced .vbk to tape
Have you already tried an example provided by Michael (several posts above); as mentioned there, you can even set the script as pre-job activity, so that, the job is modified before taking place. Thanks.
-
- Expert
- Posts: 116
- Liked: 14 times
- Joined: Nov 26, 2013 6:13 pm
- Full Name: Michael Cook
- Contact:
Re: Write latest active full produced .vbk to tape
Based on the example Vladimir is referring to (second post in this thread) you can choose the latest or second latest backup by modifying "$SecondLatestVbk". If you change the end of that line to [0] you should get the latest .vbk. Whereas [1] gives you the second latest.
-
- VP, Product Management
- Posts: 6035
- Liked: 2860 times
- Joined: Jun 05, 2009 12:57 pm
- Full Name: Tom Sightler
- Contact:
Re: Write latest active full produced .vbk to tape
I have a script that does this but it was created specifically for a customer so I need to scrub it and make it a little more generic before I can post it here. I'll try to do that in the next few days.
-
- Enthusiast
- Posts: 92
- Liked: 18 times
- Joined: May 21, 2014 12:15 pm
- Full Name: Remko de Koning
- Contact:
Re: Write latest active full produced .vbk to tape
I finally had the time to take a look at this. Thanks all for your excellent feedback.
I seem to have an additional issue with Powershell. The Snap-in does not load.
Googling on the subject reveals that I should have a "Veeam.Backup.PowerShell.dll" in the C:\Program Files\Veeam\Backup and Replication\Backup folder.
It does not seem to be there.
Any advice what I can do to correct this or should I open a new topic or create a support case?
I seem to have an additional issue with Powershell. The Snap-in does not load.
Code: Select all
Start-VBRJob LatestProdVBK
Add-PSSnapin : No snap-ins have been registered for Windows PowerShell version 4.
At line:1 char:1
+ Add-PSSnapin VeeamPSSnapin
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : InvalidArgument: (VeeamPSSnapin:String) [Add-PSSnapin], PSArgumentException
+ FullyQualifiedErrorId : AddPSSnapInRead,Microsoft.PowerShell.Commands.AddPSSnapinCommand
It does not seem to be there.
Any advice what I can do to correct this or should I open a new topic or create a support case?
-
- Enthusiast
- Posts: 92
- Liked: 18 times
- Joined: May 21, 2014 12:15 pm
- Full Name: Remko de Koning
- Contact:
Re: Write latest active full produced .vbk to tape
Whoops.. sorry.. Found it
http://www.veeam.com/kb1489
http://www.veeam.com/kb1489
-
- Enthusiast
- Posts: 92
- Liked: 18 times
- Joined: May 21, 2014 12:15 pm
- Full Name: Remko de Koning
- Contact:
Re: Write latest active full produced .vbk to tape
Still not going as smoothly as I hoped.
Installing the Powershell Add-In from the DVD went OK. However, I am still unable to use it.
Most likely because I am running "patch2" of Veeam Backup and Replication.
I am uncertain if I should install patch 2 again. I am afraid I might break something.
Installing the Powershell Add-In from the DVD went OK. However, I am still unable to use it.
Most likely because I am running "patch2" of Veeam Backup and Replication.
Code: Select all
PS C:\Users\p797784> Get-PSSnapin -Registered
PS C:\Users\xxxx> set-alias installutil $env:windir\Microsoft.NET\Framework\v2.0.50727\installutil.exe
PS C:\Users\xxxx> installutil "C:\Program Files\Veeam\Backup and Replication\Backup\Veeam.Backup.PowerShell.dll"
Microsoft (R) .NET Framework Installation utility Version 2.0.50727.8007
Copyright (c) Microsoft Corporation. All rights reserved.
Exception occurred while initializing the installation:
System.BadImageFormatException: Could not load file or assembly 'file:///C:\Program Files\Veeam\Backup and Replication\Backup\Veeam.Backup.PowerShell.dll' or one of its dependencies. This assembly is built by a runtime newer than the currently loaded runtime and cannot be loaded..
-
- Product Manager
- Posts: 20400
- Liked: 2298 times
- Joined: Oct 26, 2012 3:28 pm
- Full Name: Vladimir Eremin
- Contact:
Re: Write latest active full produced .vbk to tape
Have you tried a solution provided in the adjacent thread? If nothing helps, ask support team for assistance. Thanks.
-
- Novice
- Posts: 8
- Liked: never
- Joined: Feb 23, 2015 11:00 am
- Full Name: M. Ayaz Khawar
- Contact:
Re: Write latest active full produced .vbk to tape
It would be really good if a generic script will available which full active and all incremental points for tape to file job.
-
- Product Manager
- Posts: 20400
- Liked: 2298 times
- Joined: Oct 26, 2012 3:28 pm
- Full Name: Vladimir Eremin
- Contact:
Re: Write latest active full produced .vbk to tape
Not sure whether I understand your question. You mean the provided script should first list all full backups and then give your ability to choose which one of listed .vbks should be archived to tapes?
-
- Novice
- Posts: 8
- Liked: never
- Joined: Feb 23, 2015 11:00 am
- Full Name: M. Ayaz Khawar
- Contact:
Re: Write latest active full produced .vbk to tape
A generic script which find the latest full chain of backup. i.e last full+ all incremental point of job and archive on file to tape.
-
- Product Manager
- Posts: 20400
- Liked: 2298 times
- Joined: Oct 26, 2012 3:28 pm
- Full Name: Vladimir Eremin
- Contact:
Re: Write latest active full produced .vbk to tape
Then, you should modify the script provided by Michael, so that, it takes the latest .vbk, not the second latest one.
Then, check the given directory, using .vib file mask. After that, find .vib files which creation dates newer then creation date of the latest .vbk. Finally, set both latest .vbk and dependent .vibs as files to tape job source.
Thanks.
Code: Select all
$LatestVbk = $ProdBackupDirVbks | group directory | foreach {@($_.group | sort {[datetime]$_.creationtime} -desc)[0]}
Thanks.
Who is online
Users browsing this forum: No registered users and 12 guests