Quantcast
Channel: PowerShell.com – PowerShell Scripts, Tips, Forums, and Resources
Viewing all articles
Browse latest Browse all 8583

If else condition not really working.

$
0
0

As part of a script which i am writing, i have a small section for emailing results of the execution to couple of us. I put a if else condition so that we get mail only sometimes when the condition is met,

$result = Get-Content D:\admin-scripts\wrong_rulefile_format.txt | Select-String "ESCALATION=AUTO" | wc -l

result for the above command,

PS D:\admin-scripts> $result
     87

Followed by that this condition,

if ($result -gt 0) {echo Hello} else {echo Bye}

No matter what i always get Bye as the result. Not sure what i am doing wrong here.

 


Viewing all articles
Browse latest Browse all 8583