Bulk creation of Veeam Backup Jobs

October 18, 2011

 

I needed to make 50+ backup jobs in a Veeam environment and decided to create a PowerShell script to automate this repetitive work. Please find below the script I made to set most of the options within a Veeam backup job. The scripts accepts to parameters: the backup location (e.g. d:\backups) and the backup job name.

# *****************************************************
# This script creates a basic backup job
# Usage  : createbackup <backup job location> <backup job name>
# Author : Ted Steenvoorden
# Version: 1.0
# Date   : 18-10-2011

# *****************************************************

$vbrserver = Get-VBRServer | Where {$_.Type -eq “Local”}
$vbrjobname = $args[1]
$vbrfolder = $args[0]
$vbrobjects = “server1”

Add-VBRBackupJob -Name $vbrjobname -Type VDDK -Server $vbrserver -Folder $vbrfolder -Objects $vbrobjects

# Set Job options

$job = Get-VBRJob | where {$_.name -eq $vbrjobname}
$options = Get-VBRJobOptions $job
$options.VDDKMode = “san”
$options.FailoverToNetworkMode = $false
$options.Algorithm = “Syntethic”
$options.RunManually = $false
Set-VBRJobOptions -job $job -options $options

# Set Job VSS options

$vssoptions = Get-VBRJobVSSOptions $job
$Credentials = New-Object -TypeName Veeam.Backup.Common.CCredentials -ArgumentList “username”,”password”,0,0
$vssoptions.Credentials = $Credentials
$vssoptions.Enabled = $true
Set-VBRJobVSSOptions -job $job -options $vssoptions

# Set Job scheduling options

$schedule = Get-VBRJobScheduleOptions $job
$schedule.OptionsDaily.Enabled = $true
$schedule.OptionsDaily.Kind = “SelectedDays”
$schedule.OptionsDaily.Time = “19:30:00”
$schedule.RetryTimes = “1”
Set-VBRJobScheduleOptions -Job $job -Options $schedule

Advertisements

Bulk changes on Veeam Backup Jobs with Powershell

October 7, 2011

Recently I had to make some changes on backup objects in Veeam backup jobs. These changes consisted of disabling Guest file system indexing for most backup objects. Since these needed to be changed on 100+ backup objects I decided to make a PowerShell script using the Veeam Backup & Replication powershell support.

The following scripts disables Guest file system indexing mode for all backup objects in all backup jobs.

# ***************************************************
# This script sets the Guest file system indexing mode to
# disabled for all backup objects within all backup jobs
# Author : Ted Steenvoorden
# Version: 1.0
# Date   : 06-10-2011
#
# ***************************************************

$jobs = Get-VBRJob | where {$_.jobtargettype -eq “Backup”} | sort name

foreach ($job in $jobs)
{
$jobobjects = Get-VBRJobObject $job

foreach ($jobobject in $jobobjects)
{
$vssoptions = get-VBRJobObjectVssOprions -Object $jobobject
$vssoptions.GuestFSIndexingType = “none”
Set-VBRJobObjectVssOprions -object $jobobject -options $vssoptions
}
}