Ends an interactive session with a remote computer. (Exit-PSSession)

   

# NAME
Exit-PSSession

# SYNOPSIS
Ends an interactive session with a remote computer.

# SYNTAX
Exit-PSSession [<CommonParameters>]

# DESCRIPTION
The Exit-PSSession cmdlet ends interactive sessions that you started by using Enter-PSSession.

You can also use the Exit keyword to end an interactive session. The effect is the same as using Exit-PSSession.

# PARAMETERS
<CommonParameters>
This cmdlet supports the common parameters: Verbose, Debug,
ErrorAction, ErrorVariable, WarningAction, WarningVariable,
OutBuffer and OutVariable. For more information, type,
"get-help about_commonparameters".

# INPUTS
None
You cannot pipe objects to Exit-PSSession.

# OUTPUTS
None
This cmdlet does not return any output.

# NOTES

This cmdlet takes only the common parameters.

# EXAMPLE 1

C:\PS>Enter-PSSession -computername Server01

Server01\PS> Exit-PSSession

C:\PS>

# Description
-----------
These commands start and then stop an interactive session with the Server01 remote computer.

# EXAMPLE 2

C:\PS>$s = new-pssession -computername Server01

C:\PS> Enter-PSSession -session $s

Server01\PS> Exit-PSSession

C:\PS> $s

Id Name ComputerName State ConfigurationName
-- ---- ------------ ----- -----------------
1 Session1 Server01 Opened Microsoft.PowerShell

# Description
-----------
These commands start and stop an interactive session with the Server01 computer that uses a Windows PowerShell session (PSSession).

Because the interactive session was started by using a Windows PowerShell session (PSSession), the PSSession is still available when the interactive session ends. If you use the ComputerName parameter, Enter-PSSession creates a temporary session that it closes when the interactive session ends.

The first command uses the New-PSSession cmdlet to create a PSSession on the Server01 computer. The command saves the PSSession in the $s variable.

The second command uses the Enter-PSSession cmdlet to start an interactive session using the PSSession in $s.

The third command uses the Exit-PSSession cmdlet to stop the interactive session.

The final command displays the PSSession in the $s variable. The State property shows the PSSession is still open and available for use.

# EXAMPLE 3

C:\PS>Enter-PSSession -computername Server01

Server01\PS> exit

C:\PS>

# Description
-----------
This command uses the Exit keyword to stop an interactive session started by using the Enter-PSSession cmdlet. The Exit keyword has the same effect as using Exit-PSSession.

RELATED LINKS
Online version: http://go.microsoft.com/fwlink/?LinkID=135212
about_PSSessions
about_Remote
Enter-PSSession
New-PSSession
Get-PSSession
Remove-PSSession
Invoke-Command

C:\Windows>powershell get-help New-PSSessionOption -full

ColorConsole [Version 1.7.1000] PowerShell 2.0-Export
Microsoft Windows [Version 6.1.7600]
Copyright (c) 2014 Microsoft Corporation.

OS: Windows 10, 8.1, 8, 7, Vista / Windows Server 2016, 2012, 2008
»»»» ColorConsole









... Windows-10




Windows 10 How To

... Windows 10 FAQ
... Windows 10 How To




PowerShell: Ends an interactive session with a remote computer.

HTTP: ... PS_Windows/en/Exit-PSSession.htm
0.202
12159

I´m missing the invert selection function in windows 7 explorer  ?

 /

Does the SIEMENS NIXDORF keyboard work on Windows 10/11?

 /

Wie kann ich das Windows 10 herunterfahren?

 /

Block emails from specific senders in Microsoft Outlook!

 /

Funktioniert Don't Sleep unter MS Windows 11!

 /

Notice this is a private parking lot - Short-Car-Note!

 /

Can I control aggressive programs under Windows 8.1 and 10?

 /

Farbfiltereinstellungen in Windows 11 anpassen!

 /

All subfolders in Explorer show shortcut directory tree!

 /

Produkt-Key bei Windows auslesen?

 /

Overwrite the file X-Times if necessary for safe erase!

 /

Your Android device does not support data connection error message!

 /