close all powershell sessions on machine
<p>I've created a huge API which allows calling powershell from C#.</p>

<p>I've handled quite a few things automatically, but i seem unable to handle powershell sessions properly upon a crash. Which results in at somepoint i will be utterly unable to connect to the WINRM service on a remote PC.</p>

<p>Is there a way to get ALL remote sessions? i know</p>

<pre><code>Get-PSSession
</code></pre>

<p>But it only gets all remote sessions in the current session, and that's practically useless to me.
Any suggestions?</p>