Contact Info

Crumbtrail » Administration » Powershell » Powershell 2.0 » Remove-PSSession

Remove-PSSession - Powershell 2.0 CmdLet

Microsoft Windows PowerShell is a command-line shell and scripting tool based on the Microsoft .NET Framework. It is designed for system administrators, engineers and developers to control and automate the administration of Windows and applications.

More than hundred command-line tools (so called "cmdlets") can be used to perform system administration tasks and Windows Management Instrumentation (WMI). These cmdlets are easy to use, with standard naming conventions and common parameters, and standard tools for piping, sorting, filtering, and formatting data and objects.


Short description
Closes one or more Windows PowerShell sessions (PSSessions).

Remove-PSSession [[-ComputerName] <string[]>] [-Confirm] [-WhatIf] [<CommonParameters>]

The Remove-PSSession cmdlet closes Windows PowerShell sessions (PSSessions) in the current session. It stops any co
mmands that are running in the PSSessions, ends the PSSession, and releases the resources that the PSSession was us
ing. If the PSSession is connected to a remote computer, Remove-PSSession also closes the connection between the lo
cal and remote computers.

To remove a PSSession, enter the Name, ComputerName, ID, or InstanceID of the session. 

If you have saved the PSSession in a variable, the session object remains in the variable, but the state of the PSS
ession is "Closed."