Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>From what I can tell...</p> <p>The PSSessions you created live on "MyServerName" and, for the duration of the session you first created them, will also be returned by Get-PSSession (with no arguments, in the PowerShell window on the box you're remoting FROM). When you close the session they are created in, the sessions are no longer on your computer. This is why Get-PSSession doesn't return anything when you close and open a new PowerShell window. They never "lived" on your computer, they are remote sessions, however, they were <em>in scope</em> in your original PowerShell window because that is the local scope you created them in. </p> <p>If your sessions are still on MyServerName, as it seems they are due to the error you mention about max sessions, then typing the following command should list them:</p> <pre><code>Get-PSSession -ComputerName MyServerName </code></pre> <p>If you wanted to reconnect them all in your existing session/window, you could do:</p> <pre><code>Get-PSSession -ComputerName MyServerName | Connect-PSSession </code></pre> <p>To remove them all, enabling you to create new PSSessions to MyServerName </p> <pre><code>Get-PSSession -ComputerName MyServerName | Remove-PSSession </code></pre> <p>Looking a bit further in the docs, all sessions do not live indefinitely when you close your PowerShell window. See:</p> <blockquote> <p><code>Get-Help about_Remote_Disconnected_Sessions -ShowWindow</code></p> <p>partial excerpt (with emphasis mine):</p> <p>If you close (exit) the session in which a PSSession was created while commands are running in the PSSession, Windows PowerShell maintains the PSSession in the Disconnected state on the remote computer. <strong>If you close (exit) the session in which a PSSession was created, but no commands are running in the PSSession, Windows PowerShell does not attempt to maintain the PSSession.</strong></p> </blockquote> <p>From what I can see, sessions that aren't a) disconnected, or b) busy running a command, are discarded when you close the PowerShell window you started the PSSessions from. Additionally, the documentation does seem to mention there are also timeouts (which probably depend on PSSessionConfigurations on the server, but I don't know anything about those yet myself (other than they exist).</p> <p>This was a good excuse for me to sift through some of the PowerShell Remoting documentation, also look at:</p> <pre><code>Get-Help *PSSession* Get-Help *remote* </code></pre>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload