I'm trying to create a remote PowerShell connection between a Windows 10 x64 machine and an Ubuntu 16.04 x64 machine through WSMan --- I know that for PowerShell Core SSH can be used but I'm interested in WSMan at this moment.

First, I've installed PowerShell 7.0.1, then omi-psrp-server on the ubuntu target like this:

wget http://packages.microsoft.com/config/ubuntu/16.04/packages-microsoft-prod.deb
dpkg -i packages-microsoft-prod.deb
apt-get update
apt-get install -y powershell

# manually downloaded omi .deb package from https://github.com/Microsoft/omi/releases/tag/v1.6.0
dpkg -i omi-1.6.0-0.ssl_100.ulinux.x64.deb

# manually downloaded psrp .deb package from https://github.com/PowerShell/psl-omi-provider

Then, I've stopped the firewall on the target:

systemctl disable firewalld
systemctl stop firewalld

Finally, on Windows I've added the target (actually any target) as a trusted host

set-item WSMan:\localhost\Client\TrustedHosts -Value "*" -Concatenate

I've tested the connection between the two machines before and after installing omi-psrp-server from powershell and indeed, after the installation, the TCP test succeeded:

Test-NetConnection -Computername $target -Port 5985

But when I try to connect to the target using:

Invoke-Command -ComputerName $target -Credential root { $PSVersionTable }

I get the following error:

Connecting to remote server xx.xx.x.xxx failed with the following error message : The client cannot
connect to the destination specified in the request. Verify that the service on the destination is 
running and is accepting requests. Consult the logs and documentation for the WS-Management service 
running on the destination, most commonly IIS or WinRM. If the destination is the WinRM service, run 
the following command on the destination to analyze and configure the WinRM service: "winrm 
quickconfig". For more information, see the about_Remote_Troubleshooting Help topic.

Am I missing any setup steps on the target machine? Or is it because I'm trying a connection over HTTP and not HTTPS? omi-psrp-server accepts connections over HTTP, right? --- setting up connections over HTTPS would be a lot harder because of some certificates problem.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.