PowerTip: Use PowerShell to View Trusted Hosts


Summary:  Learn how to use Windows PowerShell to view trusted hosts on a local computer.

Hey, Scripting Guy! Question How can I find out if any trusted hosts are configured on my local computer?

Hey, Scripting Guy! Answer Use the Get-Item cmdlet and view the trusted hosts from the WSMan drive, as shown here.

Get-Item WSMan:\localhost\Client\TrustedHosts

 

Comments (5)

  1. Anonymous says:

    To delete WinRM Set WinRM/Config/Client ‘@{TrustedHosts="ProvideOnlyRequredHosts"}’ or WinRM Set WinRM/Config/Client ‘@{TrustedHosts=""}’ # Removes All

  2. Andy says:

    How do I delete an item in the trusted hosts list?

  3. AJADMiN says:

    on local computer:

    make sure the remote service is running on your local computer using get-service winrm
    if not enable using Enable-PSRemoting –force
    winrm s winrm/config/client ‘@{TrustedHosts="RemoteComputer"}
    and also the trusted host name should be a fully qualified domain name

    on Remote computer:

    make sure windows remote Management HTTP in-bound is open
    use the right credentials

  4. AJADMiN says:

    I would like to correct myself here with the following command on the Local computer

    Set-Item wsman:localhostClientTrustedHosts remotecomputer -Concatenate -Force

    use -Concatenate to add the remotecomputer to an existing one otherwise it will overwrite the existing one

    any one knows how to see the full list of trustedhosts?

    1. xpress says:

      Get-Item WSMan:\localhost\Client\TrustedHosts

Skip to main content