참고: https://www.thomasmaurer.ch/2020/04/enable-powershell-ssh-remoting-in-powershell-7/
- 최신 PowerShell 7 설치
https://github.com/PowerShell/PowerShell/releases/tag/v7.1.4
여기서 다운로드 받은 .msi 파일을 GUI 및 Core에서 모두 설치 가능 - 최신 Win32 OpenSSH Server 설치
설치여부 확인하기: Get-WindowsCapability -Online | ? Name -like ‘OpenSSH*’
설치하기: Add-WindowsCapability -Online -Name OpenSSH.Server~~~~0.0.1.0
서비스 시작하기: Start-Service -Name sshd - SSH Remoting 실행하기
pwsh.exe ##powershell 7로 변경하기
Install-Module -Name Microsoft.PowerShell.RemotingTools
Enable-SSHRemoting
Restart-Service -Name sshd - SSH Client에서 OpenSSH 서버에 연결
ssh username@servername - SSH로 Remoting하기-1
$session = New-PSSession -HostName win2022core -UserName administrator
Enter-PSSession -Session $session
** New-PSSession에서 -ComputerName 및 -Credential을 사용하면 WinRM으로 접속(5985포트)하고,
-HostName 및 -UserName을 사용하여 접속하면 SSH(22포트)접속하는 것이다.
** Linux에 PowerShell Core를 설치하면 Linux와 연결할 때는 22포트로 연결하여 원격 관리를 할 수 있다
$PSVersionTable
hostname
cmd /c ver
Exit-PSSession - SSH로 Remoting하기-2
Invoke-Command $session { Get-Process powershell } - OpenSSH 제거하기
Remove-WindowsCapability -Online -Name OpenSSH.Client~~0.0.1.0Remove-WindowsCapability -Online -Name OpenSSH.Server~~0.0.1.0

