PSSession
noun
say it: “pee-ess SESH-un” /ˌpiˈɛs ˈsɛʃən/
An open remoting connection to another computer that several PowerShell commands can use, until it is closed.
What is a PSSession?
A PSSession is a connection to another computer that you open once and keep, like a phone call you leave on while you do several things. New-PSSession opens it; Copy-Item -ToSession, Invoke-Command -Session and Enter-PSSession -Session all use it; Remove-PSSession hangs up.
$session = New-PSSession -ComputerName back-office
Copy-Item -Path .\weekly-report.txt -Destination 'C:\Reports\' -ToSession $session
Remove-PSSession -Session $session
In a sentence
- “Sam opened a PSSession to back-office, copied the report over and closed it again.”
- “One PSSession carried the copy and the command that ran afterwards.”
Level: Freelancer · More PowerShell terms at this level
Updated