Set-VBRFileToTapeJob

PowerShell script exchange

Set-VBRFileToTapeJob

Veeam Logoby bertdhont » Thu Jan 29, 2015 4:31 pm

I've used the comand 'Set-VBRFileToTapeJob' to change a file-to-tape job, so only the file I want is written to tape.

Code: Select all
$LastFile = $backup.getstorages() | sort CreationTime -descending | Select -First 1
$TapeJob = Get-VBRTapeJob -Name $FullBackupJobName
$FileList = New-VBRFileToTapeObject -Path $LastFile.FilePath
Set-VBRFileToTapeJob -Job $TapeJob -Object $FileList


This works fine, but how can I use this to add multiple files to the file-to-tape job.
When I check the powershell guide, it tells me it is possibe, but I don't know how...

Object:
Specifies the source file system object.
Accepts VBRFileToTapeObject object.
You can assign multiple files to this object.

Kind Regards
bertdhont
Service Provider
 
Posts: 20
Liked: 3 times
Joined: Fri Nov 08, 2013 2:53 pm
Full Name: Bert D'hont

Re: Set-VBRFileToTapeJob

Veeam Logoby v.Eremin » Fri Jan 30, 2015 9:54 am

It's just a matter of working with an array, try the following example:

Code: Select all
$Job = Get-VBRTapeJob -name "Name of your file to tape job"
$File1 = New-VBRFileToTapeObject -Path "First path"
$File2 = New-VBRFileToTapeObject -Path "Second path"
$Object = @($File1, $File2)
Set-VBRFileToTapeJob -Job $Job -Object $Object


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

Re: Set-VBRFileToTapeJob

Veeam Logoby winnt » Fri Apr 03, 2015 9:25 pm

How do we specify the remote server name that has the drive attached? When I use the above example, it assumes it is the local Veeam server and can't find the path. I try to specify the server name, and I get errors. When I view the object details, the server name is listed as "Veeam.Backup.Core.Common.CHost" not matter which server is specified in the GUI. Thank you.
winnt
Influencer
 
Posts: 15
Liked: 7 times
Joined: Fri Apr 03, 2015 9:19 pm
Full Name: J D

Re: Set-VBRFileToTapeJob

Veeam Logoby winnt » Fri Apr 03, 2015 9:34 pm

I figured it out. I had to add these lines:

$File1Server = get-vbrserver -name "BACKUP03"
$File1 = New-VBRFileToTapeObject -Path "Q:\SQL" -IncludeMask "*.bak" -Server $File1Server
$File2 = New-VBRFileToTapeObject -Path "C:\Scripts" -IncludeMask "*.txt"
$Object = @($File1, $File2)

Thanks for the code to get me started.
winnt
Influencer
 
Posts: 15
Liked: 7 times
Joined: Fri Apr 03, 2015 9:19 pm
Full Name: J D

Re: Set-VBRFileToTapeJob

Veeam Logoby v.Eremin » Mon Apr 06, 2015 9:25 am

Yep, as mentioned in our Help Center, -Server parameter can be used to specify the source server where files to backup are located. Glad to hear you were able to find it yourself.
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