I have this situation in my script:
$Excludes = "Commvault","Veeam"
$testuser = 'DOMAIN\vCommvaultConnect'
$Excludes | ForEach-Object {
If ($testuser.Contains($_)) {
Write-Host "Found"
}
}
Is this the most efficient way to test for this or is there a faster way to match a user to each of those excluded words?