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

Application group creation

Post by matteu »

Hello,

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
HannesK
Product Manager
Posts: 14840
Liked: 3086 times
Joined: Sep 01, 2014 11:46 am
Full Name: Hannes Kasparick
Location: Austria
Contact:

Re: Application group creation

Post by HannesK »

Hello,
thanks for sharing with the community 👍

Best regards,
Hannes
Post Reply

Who is online

Users browsing this forum: No registered users and 16 guests