Solved

Running a batch file when a service stops.

Posted on 2008-06-22
5
423 Views
Last Modified: 2012-05-05
I want to setup my servers so that when a windows service stops that it runs a batch file which triggers a .ps1 script that sends me a mail. I know that my bat file works but how can I make windows run that bat file when a service stops?
0
Comment
Question by:technolutions
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 3
  • 2
5 Comments
 
LVL 26

Expert Comment

by:farhankazi
ID: 21841840
You can configure service "Recovery" option to "Run a program" (or batch file) when service fails.

Click Start -> Run -> Services.msc -> Right click on Service -> Properties -> Recovery -> Under First failure drop down list select "Run a program" -> Click browse button and select batch file that you want to run.

Hope this helps!
Farhan
0
 

Author Comment

by:technolutions
ID: 21843710
My browse button is grayed out?!
0
 

Author Comment

by:technolutions
ID: 21843728
If I type in the path of the batch file without browsing it doesn't work when I stop the service.
0
 
LVL 26

Expert Comment

by:farhankazi
ID: 21843733
Did you select "Run a program" from "first failure" drop down list ?
0
 
LVL 26

Accepted Solution

by:
farhankazi earned 250 total points
ID: 21843739
It will only work in case of service failure.
0

Featured Post

Secure Your Active Directory - April 20, 2017

Active Directory plays a critical role in your company’s IT infrastructure and keeping it secure in today’s hacker-infested world is a must.
Microsoft published 300+ pages of guidance, but who has the time, money, and resources to implement? Register now to find an easier way.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

I. Introduction There's an interesting discussion going on now in an Experts Exchange Group — Attachments with no extension (http://www.experts-exchange.com/discussions/210281/Attachments-with-no-extension.html). This reminded me of questions tha…
In this article we will discuss all things related to StageFright bug, the most vulnerable bug of android devices.
Learn the basics of strings in Python: declaration, operations, indices, and slicing. Strings are declared with quotations; for example: s = "string": Strings are immutable.: Strings may be concatenated or multiplied using the addition and multiplic…
The viewer will learn how to create and use a small PHP class to apply a watermark to an image. This video shows the viewer the setup for the PHP watermark as well as important coding language. Continue to Part 2 to learn the core code used in creat…

735 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question