In this article i will show how to connect to remote hosts and how to configure the list of Trusted Hosts. Because with the introduction of Windows Server Core and Nanoserver, the significance of Windows PowerShell Remoting has increased.
I am logged on to a client computer as a domain administrator. Now i try to connect to server spagr02, which is located in the same domain than me.
Enter-PSSession -ComputerName spagr02
It works like a charm. In a domain environment.
The list of Trusted Hosts with IPv4
If the computers are not in a shared domain, authentication information must be supplied with the -credential parameter, and both computers must trust each other. Keyword: TrustedHosts!
We have to configure Trusted Hosts on both computers. They have to trust each other for establishing a remote connection.
Set-Item wsman:\localhost\client\TrustedHosts -Value 192.168.0.103 -Force
Then try to connect to the remote host by using the Credential parameter.
Enter-PSSession -ComputerName HostName -Credential nano500\administrator
The list of Trusted Hosts with IPv6
To configure Trusted Hosts with IPv6 we have to place the IPv6 Link-Local Address in brackets.
Set-Item wsman:\localhost\client\TrustedHosts -Value [fe80::bc11:fa91:8674:99ba] -Force Enter-PSSession -ComputerName fe80::bc11:fa91:8674:99ba -Credential nano500\administrator
Safety is over-estimated – Configure * 😉
The list of trusted hosts can also be set to *. Then all computers can establish a remote session the host.
Set-Item wsman:\localhost\client\TrustedHosts -Value * -Force
Many PowerShell Cmdlets support the parameter -ComputerName. For checking installed Software on remote remote hosts, it´s easier to run a One-Liner with the parameter -ComputerName, instead of establishing a remote session: Windows Server: List all installed Roles and Features using PowerShell