You have three variables in your example that have "name" as part of their name. You can replace the "$name" in the conditional expression with another one if I chose the wrong one.
$exclusionpattern = @("dev", "test", "_") -join "|"
foreach ($group in $Data) {
$testName = $group.Name.Split(".")[4]
$Componentname = $group.name.split(".")[5]
$Name = $group.Name.Split(".")[6]
if ($name -match $exclusionpattern){
continue
}
If (($group.Group[-1].Value -eq "0.0") -and ($group.Group[-2].Value -eq "0.0")) {
Write-Verbose "$testName $Componentname $Name is DOWN" -Verbose
}
ElseIf (($group.Group[-1].Value -eq "2.0") -and ($group.Group[-2].Value -eq "1.0")) {
Write-Verbose "$testName $Componentname $Name is UP" -Verbose
}
ElseIf (($group.Group[-1].Value -eq "1.0") -and ($group.Group[-2].Value -eq "2.0")) {
Write-Verbose "$testName $Componentname $Name is OUT OF SERVICE" -Verbose
}
}