WinRM is not working between domain and workgroup


I’m new to powershell and trying to manage a few workstations (Win7 & Win10) in a workgroup from my computer (part of a domain, Win10). Unfortunately I’m not successful.

The following I’m trying:

Enable-PSRemoting -force

$RemoteComputer = "RemoteWS01"
$LocalComputer = "MyPC01.domain.local"

Set-Item wsman:\localhost\Client\TrustedHosts -value $LocalComputer
Set-Item wsman:\localhost\Client\TrustedHosts -value $RemoteComputer

$User = "Administrator" // remote account on WS, that's not me
$Passwd = ConvertTo-SecureString "BestPWever" -AsPlainText -Force
$Cred = New-Object System.Management.Automation.PSCredential ($User, $Passwd)

$Sess = New-PSSession -Computer $RemoteComputer -Credentials $Cred -Authentication Negotiate
Invoke-Command -Session $Sess -ScriptBlock { ping localhost }

The “New-PSSession” line fails, but I don’t know why. What do I have to take care about, when connecting from a domain to a workgroup? WinRM service is running on RemoteWS01 and firewall is completely turned off with network profile set to “private”. Any ideas?

Best regards

Negotiate won’t work, you’ll need basic and HTTPS endpoints. Check out “Secrets of PowerShell Remoting” on our eBooks menu, I covered this exact scenario.