Get-PSSession is a PowerShell cmdlet that retrieves remoting sessions managed by the current PowerShell session.
Get-PSSession retrieves the remoting sessions currently maintained by PowerShell. It lets you reuse an existing connection instead of creating another one. section 18.1
Use the session list to:
View open sessions with Get-PSSession. section 18.1
Select a session by computer name, such as Get-PSSession -ComputerName SRV02. section 18.2
Pipe a selected session to Enter-PSSession or use it with Invoke-Command. section 18.2section 18.6
Close sessions with Remove-PSSession when they are no longer needed. section 18.1
Enter a stored session
Get-PSSession -ComputerName SRV02 | Enter-PSSession
This retrieves the session connected to SRV02 and passes its PSSession object directly to Enter-PSSession. Exiting the interactive shell leaves the session open for later use. section 18.2
PS C:\> get-pssession
Run Get-PSSession without parameters to display the open remoting sessions maintained by the current PowerShell session. section 18.1
How Learn PowerShell in a Month of Lunches: Fourth Edition, Covers Windows, Linux, and macOS covers it
How deep it goes
Explains listing, computer-name filtering, and pipeline use, without detailing session-object implementation internals.
Examples
Uses SRV02 filtering, Enter-PSSession pipelines, remote process and time-zone commands, and session cleanup.
What it assumes
Assumes basic PowerShell remoting familiarity and teaches session reuse after establishing sessions with New-PSSession.
What you can do after
Operate/configure reusable remoting sessions for interactive access, Invoke-Command tasks, and deliberate cleanup.
How it connects
Connects Get-PSSession with New-PSSession, Enter-PSSession, Invoke-Command, and Remove-PSSession.
remoting sessionproduces · A remoting session is a persistent communication context, represented by an object, for executing PowerShell commands on a remote computer.
Enter-PSSessionuses · Enter-PSSession is a PowerShell cmdlet that starts an interactive session with a local or remote computer.
sessionproduces · A session is a bounded interaction context associated with a user, client, or process that may maintain state across related operations or requests.
New-PSSessionconfigures · New-PSSession is a PowerShell cmdlet that creates a persistent PowerShell remoting session to a local or remote computer.
This explainer was generated by Manning's knowledge graph from the text of Learn PowerShell in a Month of Lunches: Fourth Edition, Covers Windows, Linux, and macOS. The section links point to the parts of the book it draws on.