If you are looking for a non-user interface (for example, to write names to a file or for standard output), you can use the ExecuteCommand method in the service.
ServiceController sc = new ServiceController("ServiceName"); sc.ExecuteCommand(255);
It simply passes this command to your service, and your service will process it through OnCustomCommand
protected override void OnCustomCommand(int command) { base.OnCustomCommand(command); if (command == 255 { ...
You may need to store the status of the queue / service in a static variable so that you can access it from the OnCustomCommand routine.
source share