PowerShell Remoting allows you to execute PowerShell commands or scripts on remote computers. It enables you to manage and administer remote systems from a single computer.
PowerShell Remoting provides various useful features like background jobs, remote script execution, and remote module management. You can learn more about these features and additional remoting cmdlets in the official PowerShell documentation.
Also Read: PowerShell Books
Remember, PowerShell Remoting requires administrative privileges and proper network connectivity between the local and remote computers. Ensure that you have the necessary permissions and firewall rules configured to establish remote connections.
Assuming you are on Windows 10 with PowerShell 7 installed. Lets verify it once.
Command: Get-Host | Select-Object Version
As you can see that, the current PowerShell version is 5 but for PowerShell Remoting, your minimum version should be 7 at least.
So download the PowerShell 7 version from GitHub repository.
Extract the folder
And run pwsh.exe file by double clicking on it.
Now verify the version of PowerShell by running the following command:
Command: Get-Host | Select-Object Version
To get a list of all available commands, you can run:
Command: Get-Command
dd
To make a connection from Windows machine to Linux machine, the command is:
Command: New-PSSession -Hostname 192.168.1.13 -UserName techhyme
If you try to make a SSH session with Linux machine you may receive an error message like this.
New-PSSession: [192.168.1.13] The SSH Client session has ended with error message: The SSH transport process has abruptly terminated causing this remote session to break.
Next step is to install Open SSH client and server on Windows 10.
Lets use the PowerShell utility Add-WindowsCapabillity and run the commands.
Command: Add-WindowsCapability -Online -Name OpenSSH.Client~~~~0.0.1.0
Command: Add-WindowsCapability -Online -Name OpenSSH.Server~~~~0.0.1.0
Once OpenSSH is installed successfully, you need to start the OpenSSH Services by running the following command:
Command: Start-Service sshd
If you want to start the “sshd” service automatically when the computer boots up, then the command is:
Command: Set-Service sshd -StartupType Automatic
Now, Edit the OpenSSH configuration sshd_config located in C:\Windows\System32\OpenSSH or you can find it in C:\ProgramData\ssh\sshd_config by adding Subsystem for PowerShell.
Subsystem powershell pwsh.exe -sshs -NoLogo -NoProfile
Also make sure OpenSSH configuration file sshd_config has PasswordAuthentication set to yes.
Restart the service by using:
Command: Get-Service -Name sshd | Restart-Service
SSH remoting is now properly set on your Windows Machine.
You may also like:- How to Change User in Linux Command Line
- [Solution] Missing logstash-plain.log File in Logstash
- Understanding Netstat – The Network Monitoring Tool
- Top 40 Useful Linux Command Snippets
- Using Elasticsearch Ingest Pipeline to Copy Data from One Field to Another
- Top 10 Useful Windows Commands
- Essential Commands For Process Management in Kali Linux
- How To Install Python 2.7.18 From The Source
- How To Parse SSH Authentication Logs with Logstash
- A Comprehensive Guide to File System Commands in Linux