SID-500

Home » PowerShell » How to configure Trusted Hosts for PowerShell Remote Sessions

How to configure Trusted Hosts for PowerShell Remote Sessions

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.

Enter-PSSession

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

1

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

6.PNG

Then try to connect to the remote host by using the Credential parameter.

Enter-PSSession -ComputerName HostName -Credential nano500\administrator

7.PNG

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

1.PNG

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

Further thoughts

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


3 Comments

  1. […] For more information about PowerShell Remote Session see my article How to configure Trusted Hosts for PowerShell Remote Sessions. […]

    Like

  2. […] For installing Windows Server Roles and Features you can also establish a PowerShell Remote Session, which i described in this article: How to configure Trusted Hosts for PowerShell Remote Sessions. […]

    Like

  3. […] To do the same on a remote host simply add the command Invoke-Command and the parameter computername. Make sure, that both hosts are in the same domain. If they don´t share the same domain you have to configure them as Trusted Hosts. More about Trusted Hosts in  my article: How to configure Trusted Hosts for PowerShell Remote Sessions. […]

    Like

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

Categories

Who is the blogger?

My name is Patrick Grünauer (pewa2303). I am from Austria. On sid-500 I write about Windows, Cisco and IT-Security in English and German. Have fun while reading!

Patrick Gruenauer
Follow SID-500 on WordPress.com