CmdID / PowerShell / Cmdlets / Exit
Exit-PSSession
Ends an interactive session with a remote computer. PowerShell reference
From the PowerShell reference
Alias exsn
What it does
Ends an interactive session with a remote computer. The Exit-PSSession cmdlet ends interactive sessions that you started by using the Enter-PSSession cmdlet. You can also use the exit keyword to end an interactive session. The effect is the same as using Exit-PSSession.
Exit-PSSession [<CommonParameters>]
Start and stop an interactive session
PS C:> Enter-PSSession -ComputerName Server01
Server01\PS> Exit-PSSession
PS C:>IdentifyStart and stop an interactive session by using a PSSession object
PS C:> $s = New-PSSession -ComputerName Server01
PS C:> Enter-PSSession -Session $s
Server01\PS> Exit-PSSession
PS C:> $s
Id Name ComputerName State ConfigurationName
-- ---- ------------ ----- -----------------
1 Session1 Server01 Opened Microsoft.PowerShellIdentifyUse the exit keyword to stop a session
PS C:> Enter-PSSession -ComputerName Server01
Server01\PS> exit
PS C:>IdentifyIts page in the reference: Exit-PSSession.