I wrote a query which will get an output to text file. Below is the query:
psexec \servername netstat -aon | findstr toe >> \servernam1\c$\temp\output\a1.log
Now, I need to count the lines in the log file, if it more than 1000 lines email. I tried few options, but could not achieve email part. Below is the script:
read -r num < a1.txt
if [[ “$num” -gt 1000 ]]; then
echo “Take action!”
else
echo “All OK!”
fi