Enable / Disable Periodic active full backup

PowerShell script exchange

Enable / Disable Periodic active full backup

Veeam Logoby alex.nunley » Wed Jan 30, 2013 5:18 pm

So I am trying, fruitlessly, to go through a csv of jobs, and enable Full Backups. I can modify the schedule of the backup, but I cannot enable the fullbackup for all the jobs. Lots of them fail, saying there is no setting available to be set. Code snippet below. Am I using an incorrect method? Why does it work for some but not all?

Code: Select all
$backups = Import-csv "backup-list.csv"
foreach ($i in $backups){
$JobName = $i.VM
$job = Get-VBRJob -Name $JobName
$opt = Get-VBRJobOptions $job
$opt.BackupTargetOptions.FullBackupDays = "Friday" #Set the date for periodic full backups
$opt.Options.RootNode.EnableFullBackup = "True" #Enable Full Backup?
alex.nunley
Influencer
 
Posts: 19
Liked: never
Joined: Fri Jan 18, 2013 3:36 pm
Full Name: Alex Nunley

Re: Enable / Disable Periodic active full backup

Veeam Logoby alex.nunley » Wed Jan 30, 2013 7:32 pm

This is how I set their days and whatnot, it works fine.
Code: Select all
$JobOptions.BackupTargetOptions.Algorithm = "Syntethic"
$JobOptions.BackupTargetOptions.TransformIncrementsToSyntethic = "False"
$JobOptions.BackupTargetOptions.FullBackupScheduleKind = "Daily"
$JobOptions.BackupTargetOptions.FullBackupDays = "Monday" , "Tuesday" , "Wednesday" , "Thursday" , "Friday"


But I cannot figure out how to actually enable this setting.
alex.nunley
Influencer
 
Posts: 19
Liked: never
Joined: Fri Jan 18, 2013 3:36 pm
Full Name: Alex Nunley

Re: Enable / Disable Periodic active full backup

Veeam Logoby Sethbartlett » Wed Jan 30, 2013 7:42 pm

There should already be a post from me somewhere on this forum about this. You also need to change a scheduling option to true I believe. I believe there is a settings under .Options for basically "Enabling" the job scheduling.
Skype: Sethbartlett88 - Make sure to label who you are and why you want to add me ;)
Twitter: @sethbartlett
If my post was helpful, please like it. Sometimes twitter is quicker to hit me up if you need me.
Sethbartlett
Expert
 
Posts: 282
Liked: 25 times
Joined: Wed Nov 10, 2010 6:51 pm
Full Name: Seth Bartlett

Re: Enable / Disable Periodic active full backup

Veeam Logoby alex.nunley » Wed Jan 30, 2013 8:19 pm

I think we're going in opposite directions on this one. I have the "Job Scheduling" setup the way I want, to run every friday. That works fine.

I am looking at the scheduling options for Active Full Backup. This does not appear to be affected at all by the scheduling options.

a screen of the gui.

Image
alex.nunley
Influencer
 
Posts: 19
Liked: never
Joined: Fri Jan 18, 2013 3:36 pm
Full Name: Alex Nunley

Re: Enable / Disable Periodic active full backup

Veeam Logoby v.Eremin » Thu Jan 31, 2013 1:42 pm

Hi, Alex.

It seems to me that you’ve missed a very crucial line in the code provided above. The one which would be responsible for setting given options.

Try to modify your code as shown in the following example and see whether it helps. Pay special attention to the last line:

Code: Select all
$backups = Import-csv "backup-list.csv"
foreach ($i in $backups){
$JobName = $i.VM
$job = Get-VBRJob -Name $JobName
$opt = Get-VBRJobOptions $job
$opt.BackupTargetOptions.FullBackupDays = "Friday"
$opt.Options.RootNode.EnableFullBackup = "True"
Set-VBRJobOptions -job $job -options $opt


Hope this helps.
Thanks.
v.Eremin
Veeam Software
 
Posts: 13266
Liked: 968 times
Joined: Fri Oct 26, 2012 3:28 pm
Full Name: Vladimir Eremin

Re: Enable / Disable Periodic active full backup

Veeam Logoby alex.nunley » Thu Jan 31, 2013 3:30 pm

Thanks for your input. That line was not included in my post, but does exist in the script I have been working on.

Image
alex.nunley
Influencer
 
Posts: 19
Liked: never
Joined: Fri Jan 18, 2013 3:36 pm
Full Name: Alex Nunley

Re: Enable / Disable Periodic active full backup

Veeam Logoby v.Eremin » Thu Jan 31, 2013 3:54 pm

So, correct me if I’m wrong, but you’re trying to go through job stored in .csv-file and enable Full Backup for all of them. And the problem is that for some of them it works smoothly and for some it fails with “no setting available” error, right?

If so, I’d say that this issue might be related to these lines:

Code: Select all
$JobName = $i.VM
$job = Get-VBRJob -Name $JobName

Are you 100% sure that .VM parameter always coincides with the corresponding name of your job?

My assumption is that in some cases .VM parameter may differ from the real job name. In other words, there is no job with such name, so, sometimes $job variable is specified as “0” value, and as a result you see errors regarding methods that cannot be found on this object. (like in your previous script)

Consequently, if I were you, I’d definitely start my investigation with it.

Hope this helps.
Thanks.
v.Eremin
Veeam Software
 
Posts: 13266
Liked: 968 times
Joined: Fri Oct 26, 2012 3:28 pm
Full Name: Vladimir Eremin

Re: Enable / Disable Periodic active full backup

Veeam Logoby alex.nunley » Thu Jan 31, 2013 4:13 pm

Yes, I am sure that the .VM parameter coincides, as the same CSV, and thus the same .VM parameter, was used to Create the Jobs in question.
alex.nunley
Influencer
 
Posts: 19
Liked: never
Joined: Fri Jan 18, 2013 3:36 pm
Full Name: Alex Nunley

Re: Enable / Disable Periodic active full backup

Veeam Logoby alex.nunley » Thu Jan 31, 2013 5:43 pm

I do not know why, but this works one directionally. I used it to turn it on, but to test, I wanted to turn it back off. It wont. Le sigh. But I have what I wanted.

Code: Select all
Add-PSSnapin -Name VeeamPSSnapIn -ErrorAction SilentlyContinue
$backups = Import-csv "c:\temp\list.csv"
foreach ($i in $backups){
$JobName = ($i.VM)
$Job = Get-VBRJob -Name $JobName
$JobOptions = Get-VBRJobOptions $Job
$JobOptions.BackupStorageOptions.EnableFullBackup = $true
Set-VBRJobOptions $Job -Options $JobOptions
}
alex.nunley
Influencer
 
Posts: 19
Liked: never
Joined: Fri Jan 18, 2013 3:36 pm
Full Name: Alex Nunley

Re: Enable / Disable Periodic active full backup

Veeam Logoby v.Eremin » Fri Feb 01, 2013 9:24 am

I’ve tested both of the provided code examples (with .rootnode and .BackupStorageOption) and everything seems to work properly in both directions (EnableFullBackup – True, False).

So, it’s probably something related particularly to your case. Although you’ve said that were no problems with import-csv, I’d still doublecheck that, since everything apart from this method is supposed to work like a charm.

Additionally, it might be worth replacing import-csv line with Get-VBRJob method coming with necessary parameters, like type specification or whatever, and see whether it works.

Thanks.
v.Eremin
Veeam Software
 
Posts: 13266
Liked: 968 times
Joined: Fri Oct 26, 2012 3:28 pm
Full Name: Vladimir Eremin


Return to PowerShell



Who is online

Users browsing this forum: No registered users and 3 guests