How to force a Windows service failure to test its recovery settings

6

2

Is there a way to force a service failure to test if the recovery method that was set up work's correctly?

Screenshot of recovery dialogue

These are the settings in the Recovery options and I would like to test it. i doubt simply stopping the service will work because I know that when there is a problem with this specific service it still shows in status as Started but when I right click it I have the option to start it.

Yevgen

Posted 2014-10-03T21:40:49.777

Reputation: 219

Answers

2

Well, firstly, when you stop a service manually through the proper controls, it will not be recovered.

Secondly, after you stop a service in the Management Console, you'll need to refresh the page (F5) for it to display the correct status.

Now, to simulate a service failure, you can end the process the service is running under. You can find this process by going to the Services tab of the Task Manager, right-clicking, and selecting Go To Process. Note that one process may host multiple services (especially if it's svchost.exe), and ending the process will kill all those services. Also, this is an unclean exit, and may cause data corruption depending on what the service(s) was doing when you killed it.

Depending on which specific service you are trying to stop, there may be a cleaner way to simulate failure.

Bob

Posted 2014-10-03T21:40:49.777

Reputation: 51 526

Thanks. I tried to kill it via Command prompt (since I'm on remote desktop and can't press Ctrl+Alt+Del) but it says "Error: The process with PID 1692 could not be terminated. Reason: Access is denied". Is there any way around that? – Yevgen – 2014-10-03T22:29:35.553

1@user1745382 Firstly, you can launch Task Manager with Ctrl+Shift+Esc. You can also pass a CAD through Remote Desktop with Ctrl+Alt+End. Now, for access denied - you need to run the command prompt as admin. (For Task Manager, you need to click the Show processes from all users button.) – Bob – 2014-10-03T22:45:34.047

Awesome, the whole process works smoothly! Thanks for you help, and good tips for two more ways to see running task. – Yevgen – 2014-10-04T00:25:04.693

2

Find the pid of the process and use the taskkill command to kill the process as follows.

Example:


taskkill /F /pid 7236


Then wait for the process to recover. You would have to wait for the time that you have set in the recovery tab of the service's properties. Lowest is one minute. You can check the status of the service under the services tab of the task manager too.

Thanks!

Singular

Posted 2014-10-03T21:40:49.777

Reputation: 31