-
- Enthusiast
- Posts: 63
- Liked: 3 times
- Joined: Aug 14, 2012 11:34 am
- Contact:
Create Backup Job from VM folders
Hello
is there an easy way to create with powershell a backup job for each VM folder from VMware vCenter?
With Add-VBRViBackupJob I can only specify an "Entity", means a VM.
Regards
is there an easy way to create with powershell a backup job for each VM folder from VMware vCenter?
With Add-VBRViBackupJob I can only specify an "Entity", means a VM.
Regards
-
- Product Manager
- Posts: 20271
- Liked: 2252 times
- Joined: Oct 26, 2012 3:28 pm
- Full Name: Vladimir Eremin
- Contact:
Re: Create Backup Job from VM folders
Entity parameter accepts folder item, as well. I've just created a job with a folder as a source, using the following script:
Thanks.
Code: Select all
$Server = Get-VBRServer -Name "Name of your vCenter"
$Folder = Find-VBRViEntity -Server $Server -name "Name of your folder"| where {$_.type -eq "Folder"}
$Repository = Get-VBRBackupRepository -Name "Name of your repository"
Add-VBRViBackupJob -Name "Test Job" -BackupRepository $Repository -Entity $Folder
-
- Enthusiast
- Posts: 63
- Liked: 3 times
- Joined: Aug 14, 2012 11:34 am
- Contact:
Re: Create Backup Job from VM folders
Hi Vladimir, my script looks almost the same, but when I try your (or my) script I get the message:
Add-VBRViBackupJob : Cannot bind parameter 'Entity'. Cannot convert the "Testfolder" value of type "System.String" to type "Veeam.Backup.Core.Infrastructure.IViItem".
Add-VBRViBackupJob : Cannot bind parameter 'Entity'. Cannot convert the "Testfolder" value of type "System.String" to type "Veeam.Backup.Core.Infrastructure.IViItem".
-
- Product Manager
- Posts: 20271
- Liked: 2252 times
- Joined: Oct 26, 2012 3:28 pm
- Full Name: Vladimir Eremin
- Contact:
Re: Create Backup Job from VM folders
Can you provide me with the script you've created? It looks like the way you get a folder entity might be slightly wrong. Thanks.
-
- Enthusiast
- Posts: 63
- Liked: 3 times
- Joined: Aug 14, 2012 11:34 am
- Contact:
Re: Create Backup Job from VM folders
I tried it with that easy one:
$Folder = "Testfolder"
Add-VBRViBackupJob -Name "Testjob" -Entity $Folder
$Folder = "Testfolder"
Add-VBRViBackupJob -Name "Testjob" -Entity $Folder
-
- Product Manager
- Posts: 20271
- Liked: 2252 times
- Joined: Oct 26, 2012 3:28 pm
- Full Name: Vladimir Eremin
- Contact:
Re: Create Backup Job from VM folders
So, that is the problem. In the example provided by you $Folder variable contains string value "Testfolder", not the ViItem that is expected by -Entity parameter.
Try the script I've mentioned, replacing "Name of your folder" with the name of folder you want to backup.
Thanks.
Try the script I've mentioned, replacing "Name of your folder" with the name of folder you want to backup.
Thanks.
-
- Enthusiast
- Posts: 63
- Liked: 3 times
- Joined: Aug 14, 2012 11:34 am
- Contact:
Re: Create Backup Job from VM folders
I dont see the difference, my original script is:
Code: Select all
$vCenter = "<vCenter Name>"
$VeeamFolders = Find-VBRViFolder -Server $vCenter -Name "*-BKP*"
ForEach($V in $VeeamFolders)
{
Add-VBRViBackupJob -Name $V.Name -Entity $V.Name
}
-
- Product Manager
- Posts: 20271
- Liked: 2252 times
- Joined: Oct 26, 2012 3:28 pm
- Full Name: Vladimir Eremin
- Contact:
Re: Create Backup Job from VM folders
$V.Name is a string containing name of a folder, not a folder object itself. That's the difference.
In order for your script to work properly, it should be changed:
Thanks.
In order for your script to work properly, it should be changed:
Code: Select all
$vCenter = "<vCenter Name>"
$VeeamFolders = Find-VBRViFolder -Server $vCenter -Name "*-BKP*"
ForEach($V in $VeeamFolders)
{
Add-VBRViBackupJob -Name $V.Name -Entity $V
}
-
- Enthusiast
- Posts: 63
- Liked: 3 times
- Joined: Aug 14, 2012 11:34 am
- Contact:
Re: Create Backup Job from VM folders
OK, thanks, now it works.
-
- Product Manager
- Posts: 20271
- Liked: 2252 times
- Joined: Oct 26, 2012 3:28 pm
- Full Name: Vladimir Eremin
- Contact:
Re: Create Backup Job from VM folders
You're welcome. Feel free to reach us, if other help is needed. Thanks.
Who is online
Users browsing this forum: No registered users and 26 guests