-
- 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: 20415
- Liked: 2302 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: 20415
- Liked: 2302 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: 20415
- Liked: 2302 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: 20415
- Liked: 2302 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: 20415
- Liked: 2302 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.
-
- Lurker
- Posts: 1
- Liked: never
- Joined: Jul 10, 2024 5:24 pm
- Full Name: Kevin Degnan
- Contact:
Re: Create Backup Job from VM folders
Hi folks,
Resurrecting a very old thread, but I'm trying to do something similar. I'd like to automate the creation of VMware backup jobs on a per-folder basis. We have VBR 12 and I'm trying to use the Add-VBRViBackupJob cmdlet, but it has trouble converting from CViFolderItem to IViItem:
PS C:\Windows\System32> $vmEntity = Find-VBRViEntity -Server "server_name" -Name "folder_name" -VMsAndTemplates
PS C:\Windows\System32> $job = Add-VBRViBackupJob -Name "VM Backups" -Entity $vmEntity
Add-VBRViBackupJob: Cannot bind parameter 'Entity'. Cannot convert the "Veeam.Backup.Core.Infrastructure.CViFolderItem" value of type "Deserialized.Veeam.Backup.Core.Infrastructure.CViFolderItem" to type "Veeam.Backup.Core.Infrastructure.IViItem".
Has Veeam dropped support for using a folder as an entity? Or is something else going on here? Thanks in advance!
Resurrecting a very old thread, but I'm trying to do something similar. I'd like to automate the creation of VMware backup jobs on a per-folder basis. We have VBR 12 and I'm trying to use the Add-VBRViBackupJob cmdlet, but it has trouble converting from CViFolderItem to IViItem:
PS C:\Windows\System32> $vmEntity = Find-VBRViEntity -Server "server_name" -Name "folder_name" -VMsAndTemplates
PS C:\Windows\System32> $job = Add-VBRViBackupJob -Name "VM Backups" -Entity $vmEntity
Add-VBRViBackupJob: Cannot bind parameter 'Entity'. Cannot convert the "Veeam.Backup.Core.Infrastructure.CViFolderItem" value of type "Deserialized.Veeam.Backup.Core.Infrastructure.CViFolderItem" to type "Veeam.Backup.Core.Infrastructure.IViItem".
Has Veeam dropped support for using a folder as an entity? Or is something else going on here? Thanks in advance!
-
- Veeam Software
- Posts: 2123
- Liked: 513 times
- Joined: Jun 28, 2016 12:12 pm
- Contact:
Re: Create Backup Job from VM folders
Hi Kevin, welcome to the forums!
Can you check your output on $vmEntity and show the output (redacting any sensitive information like hostnames or IPs)?
I just tested quick on 12.1.2.172 and created a job with a folder without issue.
It might be the -Server flag, but I'm not confident this is the issue, but try it out that way and maybe show the output of your variables if it's not going.
Can you check your output on $vmEntity and show the output (redacting any sensitive information like hostnames or IPs)?
I just tested quick on 12.1.2.172 and created a job with a folder without issue.
Code: Select all
$server = Get-VBRserver -name 'some vCenter'
$folder = Find-VBRViEntity -Server $server -VMsAndTemplates -Name "some_folder"
$repo = Get-VBRBackupRepository -name 'some_repo'
Add-VBRViBackupJob -Name "test2" -BackupRepository $repo -Entity $folder
Job Name Type State Last Result Description
-------- ---- ----- ----------- -----------
test2 VMware Backup Stopped None Created by Powershell at 12.07.2024 16:23:46.
David Domask | Product Management: Principal Analyst
Who is online
Users browsing this forum: No registered users and 7 guests