Get-PSSession

Sessions created using New-PSSession persist until the PSSession is removed (by Remove-PSSession) or the PowerShell session ends. The following example returns sessions created in the current PowerShell session:

PS> Get-PSSession | Select-Object Id, ComputerName, State

Id ComputerName State
-- ------------ -----
1 PSTEST Opened

If the ComputerName parameter is supplied, Get-PSSession will show sessions created on that computer. For example, imagine a session is created in one PowerShell console:

$session = New-PSSession -ComputerName PSTest -Name Example 

A second administrator console session will be able to view details of that session:

PS> Get-PSSession -ComputerName PSTest | Select-Object Name, ComputerName, State

Name ComputerName State
---- ------------ -----
Example PSTest Disconnected
..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
3.133.79.70