PowerShell Remoting must be enabled on a computer in order to execute PowerShell commands remotely. To enable PowerShell Remoting, right click a PowerShell icon and click Run as administrator. In the PowerShell window, run this cmdlet:
Enable-PSRemoting -Force
❗ Note: You may have to restart the WinRM service on both computers to finish enabling PowerShell remoting.
Alternatively, you can run WinRM in a command prompt to enable PowerShell Remoting.
Enabling PowerShell Remoting From A Computer On Another Domain Or Workgroup
If you are trying to enable PowerShell Remoting to / from computers that are on different domains or part of a workgroup, you have to configure the TrustedHosts setting so the computers trust each other. To do this, on the computer you are enabling PowerShell Remoting (after having run the above cmdlet to enable it in the first place), run this cmdlet:
Set-Item wsman:\localhost\client\trustedhosts xxx
Where xxx is a comma seperated list of IPs to trust, or an asterix (*) to trust all computers.
Finally, restart the WinRM service on both computers with this command:
Restart-Service WinRM