I want to share with you the script I use to create applications group
I use what I find here as base: https://vnote42.net/2021/12/22/scriptin ... orkaround/
Code: Select all
$AppGroupName = "App group Name"
[System.Collections.Generic.List[object]]$Collection = @(
@{
VM = 'VMName1'
BackupJob= 'BackupJob1'
},
@{
VM = 'VMName1'
BackupJob= 'BackupJob2'
},
@{
VM = 'VMName1'
BackupJob= 'BackupJob1'
}
)
#Startup settings
$AllocatedMemory = 100
$EnableVMHeartbeatCheck = $false
$EnableVMPingCheck = $false
$MaximumBootTime = 600
$ApplicationInitializationTimeout = 0
$SbVMs = @()
$VSBOptParam = @{
AllocatedMemory = $AllocatedMemory
EnableVMHeartbeatCheck = $EnableVMHeartbeatCheck
EnableVMPingCheck = $EnableVMPingCheck
MaximumBootTime = $MaximumBootTime
ApplicationInitializationTimeout = $ApplicationInitializationTimeout
}
$VSBOpt = New-VBRSureBackupStartupOptions @VSBOptParam
foreach ($Item in $Collection)
{
$TestVMObject = Find-VBRViEntity -Name $Item.VM
$TestVMVbrJob = Get-VBRJob -Name $Item.BackupJob
#Add VM object to backup job
Add-VBRViJobObject -Job $TestVMVbrJob -Entities $TestVMObject
#Get VM object from backup job
$VbrJobObject = Get-VBRJobObject -Job $TestVMVbrJob -name $TestVMObject.Name | Where-Object {$_.type -eq "Include"}
#Add Startup settings for the VM
$SbVMs += New-VBRSureBackupVM -VM $VbrJobObject -StartupOptions $VSBOpt
#Remove VM object from backup job
Remove-VBRJobObject -Objects $VbrJobObject -Completely
}
#Create application group
$AppGroup = Add-VBRViApplicationGroup -Name $AppGroupName -VM $SbVMs
#Remove application group
#Get-VBRApplicationGroup -Name $AppGroupName | Remove-VBRApplicationGroup