If a remote system is not part of a domain, or is part of an untrusted domain, an attempt to connect using remoting may fail. The remote system must either be listed in trusted hosts or must use SSL.
Use of trusted hosts also applies when connecting from a computer on a domain to another computer using a local user account.
Trusted hosts are set on the client, the system making the connection. The following command gets the current value:
Get-Item WSMan:localhostClientTrustedHosts
The value is a comma-delimited list. Wildcards are supported in the list. The following function may be used to add a value to the list:
function Add-TrustedHost { param ( [String]$Hostname ) $item = Get-Item WSMan:localhostClientTrustedHosts $trustedHosts = @($item.Value -split ',') $trustedHosts = $trustedHosts + $Hostname | Where-Object { $_ } | Select-Object -Unique $item | Set-Item -Value ($trustedHosts -join ',') }