PowerShell script exchange
Post Reply
Posts: 376
Liked: 23 times
Joined: Jul 18, 2011 9:30 am
Full Name: Hussain Al Sayed
Location: Bahrain

Edit Backup Job FileToTapeJob

Post by habibalby » Jul 30, 2018 6:20 am

I have a punch of files being backed up using File to Tape Backup Job. Due to the size of the files, I have split the files into multiple jobs in order to run success and fast backup jobs. Those files are getting change and new folders are added into the backup location. In order to have a reliable backup and I don't miss any files newly being added to the backup location, I'm thinking of scripting this to amend the existing jobs to include the differential files/new files added.

I don't know if my logic is right or wrong, but simply I just need to add the new files/folders added to the backup location and I don't miss them.

Code: Select all

Asnp VeeamPssnapin
$Job = Get-VBRTapeJob -Name "Office 365 Backup -0"
$1 = Get-Item -Path $Job.Object | Select -ExpandProperty Name
$2 = Get-ChildItem -Path 'E:\Backup\Office 365'  | Where-Object { $_.Name -le "1"} | Select -ExpandProperty  Name
$Add = Compare-Object $1 -DifferenceObject $2 | ? {$_.Sideindicator -eq '=>'} | Select InputObject

#How can I add the difference objects into the existing jobs... 
Add-VBRFileToTapeJob -Name $Job -Object $Add

Product Manager
Posts: 16232
Liked: 1325 times
Joined: Oct 26, 2012 3:28 pm
Full Name: Vladimir Eremin

Re: Edit Backup Job FileToTapeJob

Post by v.eremin » Aug 03, 2018 5:07 pm

You will need to construct a new file to tape job object, using New-VBRFileToTapeObject cmdlet. The object should combine previous files and new ones.

Then, you will need to pass the resulting object to Set-VBRFileToTapeJob.


Post Reply

Who is online

Users browsing this forum: No registered users and 3 guests