PowerShell script exchange
Post Reply
matteu
Veeam Legend
Posts: 821
Liked: 128 times
Joined: May 11, 2018 8:42 am
Contact:

Create application group

Post by matteu »

Hello,

I would like to automate Application group creation but it's really harder than I thought !

My input :
-VM name
-Application group Name

What I want to do :
Create application group from a list of VM and I want to disable ping and heartbit test and application timeout to 0.

My backup job use tags and this is where it's becoming harder....

I find this excellent post : https://vnote42.net/2021/12/22/scriptin ... orkaround/

Unfortunately I need to put the backup job as input here and I don't want.

I would like to know how can I find in what job my VM is. If there are several job, I would like the latest executed only.

I know I have to use the following command to find my VM object:
Find-VBRViEntity -Name "MyVM"

Now how can I know in what job it is ?
oleg.feoktistov
Veeam Software
Posts: 2010
Liked: 669 times
Joined: Sep 25, 2019 10:32 am
Full Name: Oleg Feoktistov
Contact:

Re: Create application group

Post by oleg.feoktistov »

Hi Matteu,

Unfortunately, currently I can't really offer you any solution except for the workaround you found.
With v12, however, we are introducing restore points as an entry route instead of just objects in job of VM type to enable
adding backed up objects no matter what type of container is added to a job.

As for finding out where a VM belongs when job objects are tags, I'd say you need to do it in reverse using PowerCLI:
1. Get tags as job objects.
2. Use PowerCLI to get VMs with the tag assigned.

Thanks,
Oleg
matteu
Veeam Legend
Posts: 821
Liked: 128 times
Joined: May 11, 2018 8:42 am
Contact:

Re: Create application group

Post by matteu »

Hello,

Thanks for the answer.
I'm not sure to understand what you mean with powercli.

I find Get-vbrbackup to find the backup object from the VM name but there is no link to the jobs used to create this backup.
I would like a way where I provide a VM name and I get all jobs where this VM is. This is not possible now ?

I saw the obsolete command Add-VSBViApplicationGroup wich is excellent to create the application group from VM name but I can't set the startup settings :(
oleg.feoktistov
Veeam Software
Posts: 2010
Liked: 669 times
Joined: Sep 25, 2019 10:32 am
Full Name: Oleg Feoktistov
Contact:

Re: Create application group

Post by oleg.feoktistov »

Hi,

I mean PowerCLI powershell module by VMware.

Actually backups have bindings with jobs. Have a look at JobId property in a backup object.
If you have VMs as job objects you can search them through in backups and correlate.
However, two problems here in your scenario:

1. You have tags as job objects. It means you would need to check if a certain vm belongs to a tag added as a job object.
That's why I mentioned PowerCLI. VMs you can obtain with Find-VBRViEntity just don't have any information on tag assignments.

2. As soon as you correlate all the tags and VMs, you won't still be able to add tags to application groups as tags are not supported there in powershell. That's why we are planning to change an entry point for surebackup vms in v12 allowing to add restore points along with job objects.

Best regards,
Oleg
matteu
Veeam Legend
Posts: 821
Liked: 128 times
Joined: May 11, 2018 8:42 am
Contact:

Re: Create application group

Post by matteu »

Thanks for the answer.

Yes, powercli is for vmware but there is nothing about backup job name I can obtain with vmware powershell command.

1.
Why do I need to know what is my tag assignment ?
I think about : What is the last job name executed for the VM 'MyVM'.
Unfortunately the Get-VBRBackup doesn't contain any jobId property. It's only for Get-VBRJobObject

2.
Yes, I understand this point. I would like to use the workaround mentioned in my link but without the need to specify the backupjob name idealy ^^
oleg.feoktistov
Veeam Software
Posts: 2010
Liked: 669 times
Joined: Sep 25, 2019 10:32 am
Full Name: Oleg Feoktistov
Contact:

Re: Create application group

Post by oleg.feoktistov »

I wrote about PowerCLI because you mentioned that you use tags as job objects. So there could be a scenario, when a VM that's in a backup no longer has the needed tag assigned and will not be processed with the next run. Hence I'd use PowerCLI for tag assignment just to double check.
About Get-VBRBackup - are we talking about the same backup object?
With the code below it works well:

Code: Select all

$backup = Get-VBRBackup -Name 'Backup Job 1'
$backup.JobId
Even if the backup is orphaned, JobId is shown, it's just zeroed.

Thanks,
Oleg
matteu
Veeam Legend
Posts: 821
Liked: 128 times
Joined: May 11, 2018 8:42 am
Contact:

Re: Create application group

Post by matteu »

ok for powercli :)

Sorry, I don't find the command I used but it was not Get-VBRBackup for sure now :(
Post Reply

Who is online

Users browsing this forum: Semrush [Bot] and 8 guests