>I may be dense this afternoon, but huh?
Lol,
Ok, an example (stupid, but an example)...
Function Test_Time {
$a = Get-Date
If ($a.Minute -gt 30) { Return 1 }
Else { Return 0 }
}
If (Test_Time) { Write-Host 'gt 30...' }
Else { Write-Host 'lt 30...' }
This works only by fluke as the only output is the return.
What if the function necessarily generates loads of output?
Function Test_Time {
$a = Get-Date
Get-Alias
If ($a.Minute -gt 30) { Return 1 }
Else { Return 0 }
}
If (Test_Time) { Write-Host 'gt 30...' }
Else { Write-Host 'lt 30...' }
This always evals to true as a result of the slew of output that
gets written out. So how do you deal with this? I know I can hide
the output of that Get-Alias, but what if you can't avoid some output?
Thanks!
jlc
~ Finally, powerful endpoint security that ISN'T a resource hog! ~
~ <http://www.sunbeltsoftware.com/Business/VIPRE-Enterprise/> ~