Tutorial by Examples

Powershell supports standard conditional logic operators, much like many programming languages. These allow certain functions or commands to be run under particular circumstances. With an if the commands inside the brackets ({}) are only executed if the conditions inside the if(()) are met $test =...
You may want to negate a boolean value, i.e. enter an if statement when a condition is false rather than true. This can be done by using the -Not CmdLet $test = "test" if (-Not $test -eq "test2"){ Write-Host "if condition not met" } You can also use !: $test...
If you want to use the shorthand you can make use of conditional logic with the following shorthand. Only the string 'false' will evaluate to true (2.0). #Done in Powershell 2.0 $boolean = $false; $string = "false"; $emptyString = ""; If($boolean){ # this does not ru...

Page 1 of 1