PowerShell script exchange
Post Reply
Amerloc
Influencer
Posts: 12
Liked: 1 time
Joined: Mar 08, 2012 9:26 am
Full Name: Adolfo Alvarez
Contact:

Specifying a repository when creating a backup Job

Post by Amerloc »

I'm trying to automate the creation of backup jobs via PowerShell in B&R V6. I'm using the following command to create a job: Add-VBRBackupJob -Name "Job_Name" -Type "NET" -Server $server -Folder "\\Server_IP\Shared_Folder\" -Filename "File_Name" -Objects "VM_Name". This command creates a new backup job and besides, it creates a new repository called "Repository for job Job_Name". My problem is that this new repository isn't valid for the job since it's created as a "Windows Server" type by default and I'm using a shared folder on a NAS device (CIFS) and if I go to the GUI and open the properties of this new repository, everything is grayed out, so I can't change anything and, of course, if I try to run the job it fails.

I've managed to change the type of the repository by changing the type field's content from 0 to 2 on the database, and then it would let me set the credentials for the NAS and the job would run fine, but this method isn't neither automatic nor orthodox.

Besides, I've realised that when I run a backup job, It creates a new folder with the name of the job in specified repository. So, for me, It doesn't make any sense the use of 1 repository per job, with 1 repository per storage device is enough and it also simplifies the management.

In fact, I can't find any advantage on using repositories.

So, my question is: Is there a way to create a backup job specifying an existing repository as the target instead of specifying a route that would create a new repository?

Thanks in advance
ThomasMc
Veteran
Posts: 293
Liked: 19 times
Joined: Apr 13, 2011 12:45 pm
Full Name: Thomas McConnell
Contact:

Re: Specifying a repository when creating a backup Job

Post by ThomasMc »

I fell for this one as well when v6 was released but your using a legacy cmdlet

Use

Code: Select all

#vSphere Job
Get-Help Add-VBRViBackupJob
#Hyper-V Job
Get-Help Add-VBRHvBackupJob
Repo

Code: Select all

Get-Help Get-VBRBackupRepository
and use this one to get the VMs you want to add into the job

Code: Select all

#vSphere VMs
Get-Help Find-VBRViEntity
#Hyper-V VMs
Get-Help Find-VBRHvEntity
Amerloc
Influencer
Posts: 12
Liked: 1 time
Joined: Mar 08, 2012 9:26 am
Full Name: Adolfo Alvarez
Contact:

Re: Specifying a repository when creating a backup Job

Post by Amerloc »

Hi Thomas.

Thank you very much for your help, now it's doing exaclty what I wanted.
Post Reply

Who is online

Users browsing this forum: No registered users and 12 guests