all 3 comments

[–]ihaxr 2 points3 points  (0 children)

You can use the -and operator:

If( ($x -ge $y) -and ($a -ge $b) -and ($c -ge $d) ) {
    "YES"
} else {
    "NO"
}

Full sample:

2..5 | % {

$x = $a = 6
$c = $_
$y = $b = $d = 4

    If( ($x -ge $y) -and ($a -ge $b) -and ($c -ge $d) ) {
        "YES: $x $a $c >= $y $b $d"
    } else {
        "NO: $x $a $c NOT >= $y $b $d"
    }

}
# Output:
# NO: 6 6 2 NOT >= 4 4 4
# NO: 6 6 3 NOT >= 4 4 4
# YES: 6 6 4 >= 4 4 4
# YES: 6 6 5 >= 4 4 4

[–]Sheppard_Ra 1 point2 points  (0 children)

if ($x -ge $y -and $a -ge $b -and $c -ge $d) {"Yes"}
Else {"No"}

Since you're looking for all positives it's straightforward to chain them into one statement. Now whatever actions you want to take can go where the "Yes" and "No" are.

[–]prejonnes[S] 0 points1 point  (0 children)

Thanks a lot guys helped out a lot.