Reputation: 3479
To elaborate, I am creating a remote power shell session to localhost. Essentially, I am running the below command from my first power shell session(1).
$s = New-PSSession;
Now, I opened another power shell session(2) and I want to connect to the remote session created in the power session(1).
Is this possible?
I see that the remote power shell sessions created in (1) are not visible in (2). Is there a way to access those remote sessions across different power shell sessions.
Upvotes: 1
Views: 294
Reputation: 126
Fortunately this feature has been added to PowerShell 3 for the first time. By using the parameter -ComputerName
in Get-PSSession
and opening the PS sessions with the same credentials, you can get all the sessions that have been created on this remote machine by your credentials. Try to type this line in the 1st session
New-PSSession -ComputerName LocalHost
Then this line in the 2nd session
Get-PSSession -ComputerName LocalHost
I have found the following link is very useful for this topic:
Upvotes: 2