If ( $myFlag -eq 'false' )
The caused reason of no value in $myFlag is this is a definition format of dynamic variable which just exists in current job. In one world, it is creating a new variable named myFlag rather than getting the value from the variable you pre-defined. That's why no value in $myFlag.
According to your logic of script, you are getting value of myFlag which pre-defined in Variables tab, then compare it with "false". If the value of myFlag is False, print out Hit! in log, otherwise print Not Hit!. So, just change your script as:
If ('$(myFlag)' -eq 'false' ) {
Write-Host "Hit!"
} Else {
Write-Host "Not Hit!"
}
Or:
$myFlag = '$(myFlag)'
If ($myFlag -eq 'false') {
Write-Host "Hit!"
} Else {
Write-Host "Not Hit!"
}