Kevin Marquette explains what is possible with if
in Powershell:
The
-not
operator flips an expression from$false
to$true
or from$true
to$false
. Here is an example where we want to perform an action whenTest-Path
is$false
.if ( -not ( Test-Path -Path $path ) )
There’s plenty of good stuff here, so check it out.