Search This Blog

Wednesday, May 15, 2024

Powershell Global VM Exclusion

#Scenario 3: Global VM Exclusion

#Test case 1: testvm_* -passed

#test case 2: vm_* -passed

#Test case 3: vm* - failed error -unsupported entity

#Test case 4: *vm* - failed error - unsupported entity

#Test case 5: vm (no pattern)- passed. No vm excluded as cannot find vm. no error

Connect-VBRServer -Server "VBR121RTM"

$vmToExclude = Find-VBRViEntity -VMsAndTemplates -Name "*vm*" | Where-Object {$_.Type -eq "Vm"}

foreach ($vm in $vmToExclude)

{

    Add-VBRVMExclusion -Entity $vmToExclude

}

#Verify the global vm exclusion

Get-VBRVMExclusion

Disconnect-VBRServer

}