title: How to run Windows Script File in Windows service recovery
body: <p>I have written a script(.wsf) to trigger an Email when a particular service fails. For first,second and subsequent failure i have given run a program and added my .wsf file in that tab. Yet i am not getting Email alert. May i know what i should do to execute that.</p>
  
  <p>Steps taken : ( But no result/didn't work)</p>
  
  <p>1) In the run a program tab , gave the complete path of the script
  2) Written a bat file and which inturn call that .wsf file
  3)Gave the path of administrator cmd.exe path in run a program tab and gave the path of the script file in the command line parameters tab.</p>
  
  <p>Note: I have executed this separately in cmd.exe and it worked by sending Email alert.</p>
  
  <p>To make service fail i manually stopped it, restarted it yet notify didn't turned up. Please let me know what i should do further in executing the script from windows service recovery tab. I hereby added my script too.</p>
  
  <pre><code>&lt;job&gt;
  &lt;script language="VBScript"&gt;
  Option Explicit
  On Error Resume Next
  Dim WshShell
  set WshShell=CreateObject("WScript.Shell")
  WshShell.run "cmd.exe"
  WScript.Sleep 1000
  WshShell.SendKeys "telnet smtp.sample.com 25"
  
  WshShell.Sendkeys("{Enter}")
  WScript.Sleep 1000
  WshShell.SendKeys "EHLO sample.com"
  WshShell.Sendkeys("{Enter}")
  WScript.Sleep 1000
  WshShell.SendKeys "MAIL FROM:alice@sample.com"
  WshShell.SendKeys ("{Enter}")
  WScript.Sleep 1000
  WshShell.SendKeys "RCPT TO:bob@sample.com"
  WshShell.SendKeys ("{Enter}")
  WScript.Sleep 1000
  WshShell.SendKeys "DATA"
  WshShell.SendKeys ("{Enter}")
  
  WScript.Sleep 1000
  WshShell.SendKeys "Subject: Test Email"
  WshShell.SendKeys ("{Enter}")
  WshShell.SendKeys ("{Enter}")
  WScript.Sleep 1000
  WshShell.SendKeys "Body-Test Email executed by running script"
  WshShell.SendKeys ("{Enter}")
  WScript.Sleep 1000
  WshShell.SendKeys "."
  WshShell.SendKeys ("{Enter}")
  WScript.Quit 
  &lt;/script&gt;
  &lt;/job&gt;
  </code></pre>