2 Replies - 995 Views - Last Post: 16 May 2012 - 05:31 PM Rate Topic: -----

#1 justanub  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 16
  • Joined: 16-May 12

Windows Service Recovery

Posted 16 May 2012 - 10:46 AM

I am trying to write a batch file that will send me an email whenever a windows service fails. Using blat I wrote a file that sends mail, but I want to include in the email which service failed. In services.msc I can configure recovery options for each service hence therefore run my batch program. However I am not sure how to simulate a service failure or how to get the service displayName in batch file. Any help is much appreciated

If you guys would like any more information that will help you answer my question I'll be checking frequently to make changes.

Is This A Good Question/Topic? 0
  • +

Replies To: Windows Service Recovery

#2 Atli  Icon User is offline

  • D.I.C Lover
  • member icon

Reputation: 3716
  • View blog
  • Posts: 5,976
  • Joined: 08-June 10

Re: Windows Service Recovery

Posted 16 May 2012 - 11:42 AM

Thread moved to the Other Languages forum. Can't see this having much to do with C#.
Was This Post Helpful? 0
  • +
  • -

#3 GunnerInc  Icon User is online

  • "Hurry up and wait"
  • member icon




Reputation: 858
  • View blog
  • Posts: 2,279
  • Joined: 28-March 11

Re: Windows Service Recovery

Posted 16 May 2012 - 05:31 PM

in the command line params, could you try adding %1 to see if that passes the name of the service? Not really sure though.

Did some digging, and seems PowerShell is the way to go. You can monitor services, send email and a bunch of other things.

Search for: "powershell service monitoring scripts"

This post has been edited by GunnerInc: 16 May 2012 - 05:39 PM

Was This Post Helpful? 0
  • +
  • -

Page 1 of 1