Kill process instances programmatically

I want to Terminate all running instances of all process models in any state programmatically, whats the best way to achieve that?

  Discussion posts and replies are publicly visible