Код:

$VMlist = Get-VM
$VMToExclude = "HYPER - VM100","HYPER - VM200"
foreach ($VM in $VMList)
{
if($VM.VMName -match "HYPER\s?-\s?VM\d+" -and !($VMToExclude -contains $VM.VMName)) {
Add-VMNetworkAdapterAcl -VMName $VM.VMName -Direction Both -RemoteIPAddress 172.28.0.0/16 -Action Deny -Weight 1
Add-VMNetworkAdapterAcl -VMName $VM.VMName -RemoteIPAddress 172.28.0.1 -Direction Both -Action Allow -Weight 2
}
}