PowerShell script exchange
Post Reply
asterix91
Novice
Posts: 5
Liked: 1 time
Joined: Feb 28, 2020 3:10 pm
Contact:

[Powershell] Veeam 10 - Application Groupe

Post by asterix91 »

Hello,

I have create some application groupe for surbackup.
All I want is to be able to add VMs via the last backup performed in the group application using Powershell, without having to delete the groups to recreate them.
I look this documentation of veeam 10 : https://helpcenter.veeam.com/docs/backu ... ml?ver=100.

I tried several times, I can create group apps, but once the group create with a VM in it, it is completely impossible for me to add one ...

If you can help me I will appreciate it very much

Asterix91.
veremin
Product Manager
Posts: 20413
Liked: 2301 times
Joined: Oct 26, 2012 3:28 pm
Full Name: Vladimir Eremin
Contact:

Re: [Powershell] Veeam 10 - Application Groupe

Post by veremin »

You need to:

- get a VMs inside the application group
- assign them to a variable
- use New-VBRSureBackupVM cmdlet to create new VM
- add it to the variable
- assign new VM list to application group via Set-VBRViApplicationGroup cmdlet

Thanks!
asterix91
Novice
Posts: 5
Liked: 1 time
Joined: Feb 28, 2020 3:10 pm
Contact:

Re: [Powershell] Veeam 10 - Application Groupe

Post by asterix91 »

Hello,

Here is how I try:

Code: Select all

# Get VM I want in variable
$Veeamname = Find-VBRViEntity -Name "fqdn"
#  use New-VBRSureBackupVM cmdlet to create new VM
$vms = New-VBRSureBackupVM -VM $veeamname
Here is the return of powershell :

Code: Select all

Impossible de lier le paramètre «VM». Impossible de convertir la valeur «Veeam.Backup.Core.Infrastructure.CViVmItem» du type «Veeam.Backup.Core.Infrastructure.CViVmItem» en type «
Veeam.Backup.Core.CObjectInJob».

I also try: https://helpcenter.veeam.com/docs/backu ... ml?ver=100

$job = Get-VBRJob -Name "JOBNAME"
$backupobject = Get-VBRJobObject -Job $job -Name "fqdn"

Why the variable : $backupobject is NULL ?

thank you in advance for your help.

Can you give me some script example please ?

Asterix91.
asterix91
Novice
Posts: 5
Liked: 1 time
Joined: Feb 28, 2020 3:10 pm
Contact:

Re: [Powershell] Veeam 10 - Application Groupe

Post by asterix91 »

The variable backupobject is NULL because I create backup Job with TAG vmware.

So how can I add VMs in group applications ?
veremin
Product Manager
Posts: 20413
Liked: 2301 times
Joined: Oct 26, 2012 3:28 pm
Full Name: Vladimir Eremin
Contact:

Re: [Powershell] Veeam 10 - Application Groupe

Post by veremin »

What happens, if you get a tag via Get-VBRJobObject cmdlet and then pass it to New-VBRSureBackupVM cmdlet.

This is how you can get a tag:

Code: Select all

asnp VeeamPSSnapin
$Job = Get-VBRJob -name "Name of your backup job"
$Tag = $Job | Get-VBRJobObject | where {$_.TypeDisplayName -eq "Tag" -and $_.Name -eq "Name of your tag"}
$Tag
The last is line is just to check whether the variable is assigned properly.

Thanks!
oleg.feoktistov
Veeam Software
Posts: 2010
Liked: 670 times
Joined: Sep 25, 2019 10:32 am
Full Name: Oleg Feoktistov
Contact:

Re: [Powershell] Veeam 10 - Application Groupe

Post by oleg.feoktistov » 1 person likes this post

Hi @asterix91,

Current implementation of New-SureBackupVm doesn't identify CObjectInJob object with type 'Tag' (only with type 'Virtual Machine'):

Code: Select all

New-VBRSureBackupVM : Object reference not set to an instance of an object.
At line:6 char:5
+     New-VBRSureBackupVM -VM $object
+     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : NotSpecified: (:) [New-VBRSureBackupVM], NullReferenceException
    + FullyQualifiedErrorId : System.NullReferenceException,Veeam.Backup.PowerShell.Cmdlets.NewVBRSureBackupVM
But I added it as a feature request for further releases!

Thanks,
Oleg
woifgaung
Veeam Software
Posts: 79
Liked: 22 times
Joined: Oct 15, 2015 2:57 pm
Full Name: Wolfgang Scheer
Contact:

Re: [Powershell] Veeam 10 - Application Groupe

Post by woifgaung »

Hello!
@oleg.feoktistov I have a question here: It is with v10 possible or not to add single VM using New-SureBackupVm to SureBackup when they were backed up using tags?

I have the situation: backup is made by tags and Get-VBRJobObject returns these tags. The current (scripted) SureBackup implementation uses Add-VSBViApplicationGroup (deprecated) which supports VMs returned from Find-VBRViEntity. New-SureBackupVm seems only to support CObjectInJob objects, returned by Get-VBRJobObject, which does not return VMs but tags.

I need to implement higher timeouts for SureBackup provided by New-VBRSureBackupStartupOptions. But these can only be set with New-SureBackupVm.

Can you help me here out?
Thanks!
Wolfgang | CEMEA Solutions Architect | vnote42.net
oleg.feoktistov
Veeam Software
Posts: 2010
Liked: 670 times
Joined: Sep 25, 2019 10:32 am
Full Name: Oleg Feoktistov
Contact:

Re: [Powershell] Veeam 10 - Application Groupe

Post by oleg.feoktistov »

Hi Wolfgang,

New-VBRSureBackupVM supports individual VMs only. Even if we add -Tag parameter here or solve this by any other means (which we plan to do in the future releases), it will still be just filtering: all the VMs tagged will be converted to an array of VMs with VBRSureBackupVM class.

I suppose, it is still possible to find a workaround here with deprecated VSB cmdlet and query PowerCLI to filter backed up VMs by a tag and then add those to an application group.

Thanks,
Oleg
woifgaung
Veeam Software
Posts: 79
Liked: 22 times
Joined: Oct 15, 2015 2:57 pm
Full Name: Wolfgang Scheer
Contact:

Re: [Powershell] Veeam 10 - Application Groupe

Post by woifgaung »

Hi Oleg!

Did I get this right: currently it is not possible to use New-VBRSureBackupVM to add VMs to application group, when VMs are selected by tags in backup job?

Thanks!
Wolfgang | CEMEA Solutions Architect | vnote42.net
oleg.feoktistov
Veeam Software
Posts: 2010
Liked: 670 times
Joined: Sep 25, 2019 10:32 am
Full Name: Oleg Feoktistov
Contact:

Re: [Powershell] Veeam 10 - Application Groupe

Post by oleg.feoktistov »

Yes, if Tag entity is added directly to a backup job, New-VBRSureBackupVM won't recognise it until you add VMs as includes instead. Thanks!
Post Reply

Who is online

Users browsing this forum: No registered users and 18 guests