Contact Info

Crumbtrail » Administration » Powershell » Powershell 3.0 » Remove-PSSession

Remove-PSSession - Powershell 3.0 CmdLet

ActiveXperts Network Monitor ships with integrated Powershell scripts to monitor complex network. The scripts run out of the box
Download the ActiveXperts Network Monitor FREE version now »


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

Remove-PSSession [-Id] <Int32[]> [-Confirm] [-WhatIf] [<CommonParameters>]
Remove-PSSession [-ComputerName] <String[]> [-Confirm] [-WhatIf] [<CommonParameters>]
Remove-PSSession -InstanceId <Guid[]> [-Confirm] [-WhatIf] [<CommonParameters>]
Remove-PSSession -Name <String[]> [-Confirm] [-WhatIf] [<CommonParameters>]
Remove-PSSession [-Session] <PSSession[]> [-Confirm] [-WhatIf] [<CommonParameters>]

The Remove-PSSession cmdlet closes Windows PowerShell sessions (PSSessions) in the current session. It stops any comman
ds that are running in the PSSessions, ends the PSSession, and releases the resources that the PSSession was using. If 
the PSSession is connected to a remote computer, Remove-PSSession also closes the connection between the local and remo
te 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 PSSessi
on is "Closed."