The Trusted Hosts List Answer
Full-Access Members Only
Sorry, this lesson is only available to Server Academy Full-Access members. Become a Full-Access member now and get instant access to this and many more premium courses. Click the button below and get instant access now.
Instructions
Q&A (0)
Notes (0)
Resources (0)
Saving Progress...
Resources
There are no resources for this lesson.
Notes can be saved and accessed anywhere in the course. They also double as bookmarks so you can quickly review important lesson material.
In this Lecture I will show you how to add computers to the Trusted Hosts Lists
In PowerShell, the TrustedHosts list is used to specify remote computers that are trusted by the local computer. When you try to establish a remote PowerShell session to a computer that is not in the TrustedHosts list, you will get an error message stating that the remote computer is not recognized as a trusted host, or a WINRM related error.
WINRM – Windows Remote Management, is a service that allows remote management of Windows-based systems over a network.
WSMAN – (WS Management) is the underlying protocol that WinRM uses for remote management in the Windows operating system.
From the Host, open PowerShell ISE in Admin Mode.
Here is the one-liner to view the current trusted Hosts List:
Go ahead and copy and paste this command into PowerShell
Get-Item WSMan:\localhost\Client\TrustedHosts
Here is the Explanation:
Get-Item: This cmdlet is used to retrieve information about an item in a PowerShell provider. In this case, it's used to get information about an item in the WSMan (Windows Remote Management) provider.
WSMan:\ This part of the command specifies the WSMan PowerShell provider, which allows you to interact with WinRM settings and configurations.
localhost: This specifies that you want to interact with the WinRM settings on the local computer. You can replace "localhost" with the name of a remote computer if you want to query its WinRM settings.
Client\TrustedHosts: This is the path within the WSMan provider hierarchy. It specifies that you want to access the TrustedHosts setting in the WinRM client configuration. The TrustedHosts setting is used to specify which remote computers are trusted when making WinRM connections. These trusted hosts can be specified as a list of remote computer names or IP addresses.
When you run this one-liner, it will return the current value of the TrustedHosts setting for the local WinRM client. This value will show you which remote computers are allowed to establish WinRM connections to the local machine.
And if we run the command we see our current trusted hosts list value of VSC1,2,3,and 4. Which displays the machines I can remotely manage.
Here is the one-liner to add computers to the Trusted Hosts List. My list of computer names will be different than yours. Just add the computers that you plan to use for this section.
Go ahead and copy and paste this command into PowerShell.
Here is the command and the explanation.
Set-Item -Path WSMan:\localhost\Client\TrustedHosts -Value 'VSC1,VSC2,VSC3,VSC4' -Concatenate
Set-Item: This is a PowerShell cmdlet used to set the value of a configuration item. In this case, it's used to set the configuration for the WinRM client.
-Path This part of the command specifies the path to the configuration item you want to set. Here's what each part of the path means:
WSMan: This is the Windows PowerShell provider for managing Windows Remote Management
localhost: This specifies that you want to interact with the WinRM settings on the local computer.
In this PowerShell command "localhost" refers to the local computer or the computer where the PowerShell command is being executed. In this context, "localhost" is a special hostname that always points to the computer on which the command is running.
So, when you run this command, you are configuring the Windows Remote Management (WinRM) client on the local computer to trust the remote hosts specified in the '-Value' parameter (in this case, 'VSC1', 'VSC2', 'VSC3', and 'VSC4') when making remote connections.
By adding these hosts to the TrustedHosts list, you're essentially saying that you trust these remote computers when connecting via WinRM.
Server Academy Members Only
Sorry, this lesson is only available to Server Academy Full Access members. Become a Full-Access Member now and you’ll get instant access to all of our courses.