Exit-PSSession ends the current interactive PowerShell remoting session and returns the prompt to the originating shell. It requires no parameters; after running it, the remote connection closes automatically. section 13.5
Leave an interactive session
After working on a remote computer, run:\n\nExit-PSSession\n\nThe prompt changes back to its normal local form. If the PowerShell window closes first, the connection closes automatically as well. section 13.5
Keep these remoting points in mind:
- Use Exit-PSSession as the counterpart to Enter-PSSession when finishing one-to-one remoting. section 13.5
- Avoid starting another Enter-PSSession from inside a remote session unless a deliberate second hop is required. section 13.5
