Search This Blog

Wednesday, May 15, 2024

Exclude VM By Pattern for Job With Predefined Object

 #Scenario 1: Exclude vm by the pattern for a job with predefined object


Connect-VBRServer -Server "VBR121RTM"

# Specify the name of the backup job and the name of the VM to exclude

$backupJobName = "Scenario 1: Ransomware Scenario"

# Specify the vm extension to exclude

$vmNameToExclude = Get-VBRJobObject -Job $backupJobName -Name "*vm*"

#test case 1 - vm*

#test case 2 - *vm

#test case 3 - *vm*

Remove-VBRJobObject -Objects $vmNameToExclude

# Get the backup job object

$backupJob = Get-VBRJob -Name $backupJobName

#Save the backup Job

Set-VBRJobOptions -Job $backupJob

Disconnect-VBRServer