Question : batch file or script that emails when finding "error" in file

I run some processes that create log files. When there is a problem, there will be some details in the log file(s) which will contain "error". I want to kick off a batch or script after the processing is complete that will check the log files and if "error" is found, send an email with some details like which file and line/text contain the error.
So, I see I can use the DOS Find command, like below, just not sure how to trigger the email when there are errors:
SET Files=C:\*Extract.log
SET LogFile=C:\Results.log
Find /I /N "error " %Files%    (I could redirect this to LogFile and maybe attach that to an email)
Find /C "error " %Files%      (maybe I could use this to see if the count is > 0 and then trigger the email)
Also, I found this vbs code to email; so, I think that part is covered:
Function sendmail
Set objMessage = CreateObject("CDO.Message")
objMessage.Subject = "Test message"
objMessage.From = "email@address"
objMessage.To = "email@address"
'objMessage.To = "email@address"
objMessage.TextBody = "test message"
objMessage.Configuration.Fields.Item ("http://schemas.microsoft.com/cdo/configuration/sendusing") = 2
objMessage.Configuration.Fields.Item ("http://schemas.microsoft.com/cdo/configuration/smtpserver") = "exchange-unc"
objMessage.Configuration.Fields.Item ("http://schemas.microsoft.com/cdo/configuration/smtpserverport") = 25
objMessage.Configuration.Fields.Update
'objmessage.Addattachment “path to attachedment if any”
objMessage.Send
End function

thanks for looking
alan

Answer : batch file or script that emails when finding "error" in file

I haven't used the scenario before, but if you get a product called "Symantec Backup Exec System Recovery 2010" on educational licenses, you can :

a) Install BESR either individually on every Virtual Server OR
Install a BESR Management Server (Free) on another server with not alot of roles already on it, and then :

b) Install BESR 2010 agents to your Virtual servers which will allow you to backup your virtual environments as physical servers onto a network share, external usb / rdx drive or your iomega drive.

BESR 2010, have the functionality of converting backup images to Hyper-V, Vmware, XEN, so you can convert your backup sets to a vhd file if need be later.

http://www.symantec.com/business/backup-exec-system-recovery-server-edition

BESR can encrypt your backups too, you can transfer or backup directly to a offsite location ftp etc.



---

http://social.technet.microsoft.com/Forums/en-US/winserverhyperv/thread/887af44e-76dd-400a-9eec-e9229c015f8e
A similar question at the above link.

With the above question too, a person takes a snaspshot via VSS (Volume Shadow) and then rsync, having BESR backing up either once a day or incrementals means more protection and a industry standard based solution.

It gives you the flexibility to convert a besr backup image into a vhd on any machine and then use it in your Hyper-V environment.
If you have Exchange, it also gives you Granular Mailbox Restores too, you would have to have Outlook 2007 or 2010 (X86 or X64) on a 64Bit windows machine and you can then browse your backup image to do granular restores - very useful.

Hope that Helps

Random Solutions  
 
programming4us programming4us