How to force a Windows service failure to test its recovery settings
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.
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!