Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to get *tmux* experience using Powershell to work remotely on a Windows server? [closed]

For remote work on a Linux server, I can ssh and then tmux to resume my work (including stdout/stderr).

How can I get the same experience on Windows server using Powershell? I have done some basic reading on Enter-PSSession but that feels like ssh without tmux.

like image 230
Fabian Avatar asked Sep 08 '15 20:09

Fabian


People also ask

How can I test WinRM remotely?

Type the following cmdlet and then hit Enter: "Restart-Service WinRM". It's time to test the connection, From the MID Server execute the following cmdlet into PowerShell and then hit Enter: "Test-WsMan <Target IP>" and This simple command tests whether the WinRM service is running on the remote Host.

Does Tmux work over SSH?

With tmux you only need one SSH connection to the server. The great thing about tmux is it allows you to have multiple panes open at the same time, each with their own shell running, but using the same, single SSH connection.


1 Answers

When you use Enter-PSSession and exit with Exit-PSSession, The Session is Permanently deleted and you can't resume it.

However, You can Create a Remote Session like this:

$session = New-PSSession -ComputerName $ComputerName

And Then Connect into it

Enter-PSSession $session

This way You Can disconnect (but the session will remain connected)

Exit-PSSession

And Reconnect again (and come back to the same state)

Enter-PSSession $session

As long as $session variable is available the session remains open and all your work remain in the same state

To Disconnect the Session:

Disconnect-PSSession $session

To remove the Session:

Remove-PSSession $session
like image 189
Avshalom Avatar answered Nov 01 '22 12:11

Avshalom