سؤال

Whenever a specific Windows service fails I want to run a program I've created myself. However, I simply can't find a way to make it fail on purpose, so that I can actually test that everything works correctly.

Note that the service in question is not something I've written myself, so I can't make it fail programmatically from inside the code. I wouldn't, however, mind writing a program that can make a service fail.

Of course I would prefer just having a "Make service fail" button somewhere in services.msc ... ;)

The server I'm doing this on is running Windows Server 2012.

هل كانت مفيدة؟

المحلول

Define "fail". If you want the process to end, just use pskill or a similar tool that can terminate a process elevated (as an admin).

نصائح أخرى

If you don't want to use command line :

As an admin open the Windows Task Manager, in the Services tab find the service you want to test. Right click the service and click on Go to process. The selected process (if any) is the one corresponding to your service. Kill this process to simulate a service failure.

Be aware that killing a process this way can lead to problems.

مرخصة بموجب: CC-BY-SA مع الإسناد
لا تنتمي إلى StackOverflow
scroll top