PowerShell 2.0: One Cmdlet at a Time 32 Exit-PSSession
Continuing the series looking at new cmdlets available in PowerShell 2.0. This time we look at the Exit-PSSession cmdlet.
What can I do with it?
Exit an interactive PowerShell session that has been opened on a computer which has been enabled for PowerShell remoting.
Example:
Leave an interactive PowerShell session with a computer which has been enabled for PowerShell remoting.
Exit-PSSession
You will notice that the prompt has changed back from
[test01]: PS C:\>
to simply
PS C:\>
Tip: When in an interactive remote session you can also just type Exit to finish the session.
How could I have done this in PowerShell 1.0?
Remoting did not exist in PowerShell 1.0, you would have needed to use Remote Desktop to run an interactive session on a remote server.