Multiple conditions to evaluate is sometimes necessary in order to decide whether the script should continue to execute a specific command or do another process. PowerShell is able to do this kind of task using if else statement. Example script below just shows 3 variables that should match and it will output "OK", the output is just a write-host command but it could be replaced with other codes. And if one of the statements does not match the "else" statement is executed. Example code: All statements or condition matches $var1 = "Online" $var2 = "Running" $var3 = "Proceed" if (( $var1 -eq "Online" ) -and ( $var2 -eq "Running" ) -and ( $var3 -eq "Proceed" )) { write-host "OK" } else { write-host "Not OK unable to Proceed" } Output: OK One of the variable does not match: $var1 = "Online" $var2 = "Running" $var...
Make the world a better place by sharing knowledge, ideas and anything that you can give that comes from the heart.