I've written myself a script to check for vm-folders in vmware vcenter that dont match the corresponding vmname. There are a few automatically deployed VMs which i need to exclude from this check. Those VMs are always similarly named, but with an incremented number at the end. I've declared an array $Vmstoginrore containing strings of them and i'm trying to match my $VmName with this array but it does not work. Ive also tried it with like but i cannot seem to get this to work.
$Vmstoignore=@( "Guest Introspection","Trend Micro Deep Security")
$VmName = "Guest Introspection (4)"
if ($Vmstoignore-match $VmName ){
Write-Output "does match"
}
else {
Write-Output "doesn't match"
}