I have a small script where I am trying to exclude names starting with "test", "dev" etc...
I want to create a separate variable as $exclusionpattern = @("dev" , "test") -join "|"
and want to use that in foreach loop to exclude names containing dev or test, also with underscores, can someone help me with their thoughts
foreach ($group in $Data) {
$testName = $group.Name.Split(".")[4]
$Componentname = $group.name.split(".")[5]
$Name = $group.Name.Split(".")[6]
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
}
}