How to Configure WinRM TrustedHosts for PowerShell Remoting in Windows 11

In modern Windows systems administration, PowerShell Remoting (via Windows Remote Management, or WinRM) enables centralized command execution, script automation, and fleet management. Within an Active Directory domain environment, WinRM secures communications automatically using mutual Kerberos authentication. However, when managing stand-alone workgroup machines, cloud virtual machines, cross-forest architectures, or dev-lab environments that lack domain trust, Kerberos cannot validate the remote server’s cryptographic identity. In these non-domain environments, the local WinRM client refuses to transmit credentials over HTTP unless the target hostname or IP address is explicitly added to the local TrustedHosts list. Using PowerShell and the WSMan: virtual drive provider, administrators can query, append, restrict, and manage TrustedHosts securely without introducing security vulnerabilities.

Security Architecture and Role of WinRM TrustedHosts

The WinRM client configuration maintains the TrustedHosts setting inside the local WSMan management hierarchy (WSMan:\localhost\Client\TrustedHosts). Understanding its security implications is vital:

  • Bypassing Mutual Kerberos Authentication: Adding a hostname or IP address to TrustedHosts informs the local WinRM client that it is permissible to initiate NTLM or Basic authentication against that remote endpoint without validating the server’s identity through a domain controller.
  • Transport Layer Encryption Preservation: Even when operating over standard HTTP (port 5985), WinRM encrypts the entire message payload after the initial handshake using symmetric session keys derived from the NTLM exchange. TrustedHosts does not transmit plaintext credentials.
  • Wildcard Risk (*): Configuring TrustedHosts to * instructs Windows to trust any remote computer, leaving client credentials vulnerable to spoofing if an attacker intercepts outbound administrative traffic on an untrusted local network. Specific hostnames or CIDR IP ranges should always be declared instead.

Auditing Existing TrustedHosts Settings in PowerShell

To inspect your current WinRM client configuration, open PowerShell with elevated administrative privileges:

# Query the current TrustedHosts value using the WSMan drive provider
Get-Item WSMan:\localhost\Client\TrustedHosts

# Alternatively, query WinRM client properties using Get-WSManInstance
(Get-WSManInstance -ResourceURI winrm/config/client).TrustedHosts

If the Value field is empty, the WinRM client operates in default high-security mode, accepting connections exclusively to Active Directory domain-joined machines that authenticate via Kerberos.

Configuring Explicit TrustedHosts Entries via Set-Item

To establish remote PowerShell connectivity to a specific server or set of servers, assign the hostname, fully qualified domain name (FQDN), or IP address using Set-Item:

# Set a single remote IP address in TrustedHosts
Set-Item WSMan:\localhost\Client\TrustedHosts -Value "192.168.10.50" -Force

# Set multiple specific hostnames and IP addresses (comma-separated string)
Set-Item WSMan:\localhost\Client\TrustedHosts -Value "Server01, Server02, 192.168.1.100" -Force

Passing -Force suppresses the interactive security confirmation prompt, making the command suitable for automated setup scripts.

Safely Appending New Endpoints Without Overwriting Existing Hosts

Executing Set-Item -Value "NewHost" overwrites the existing list entirely, severing connectivity to previously configured servers. To safely append new targets to an existing TrustedHosts string, use the -Concatenate flag:

# Append a new server to the existing TrustedHosts list
Set-Item WSMan:\localhost\Client\TrustedHosts -Value "192.168.10.60" -Concatenate -Force

# Confirm the concatenated list
(Get-Item WSMan:\localhost\Client\TrustedHosts).Value

Configuring Subnet and Domain Wildcard Patterns

For large testing laboratories or private subnets where IP addresses change dynamically, use scoped wildcards rather than a global *:

# Trust all servers within a specific internal domain suffix
Set-Item WSMan:\localhost\Client\TrustedHosts -Value "*.lab.internal" -Force

# Trust all hosts on a local private Class C subnet
Set-Item WSMan:\localhost\Client\TrustedHosts -Value "192.168.10.*" -Force

Testing Remote PowerShell Execution with Alternative Credentials

Once the remote host is registered in TrustedHosts, initiate a remote session using Enter-PSSession or execute commands via Invoke-Command, supplying explicit local administrator credentials for the remote machine:

# Prompt for credentials and establish an interactive remote session
$cred = Get-Credential
Enter-PSSession -ComputerName "192.168.10.50" -Credential $cred

# Run a remote command against the trusted endpoint
Invoke-Command -ComputerName "192.168.10.50" -Credential $cred -ScriptBlock {
    Get-Service -Name W32Time
}

Clearing and Resetting TrustedHosts to Factory Defaults

When administrative lab sessions conclude or when returning a management workstation to high-security production status, clear the TrustedHosts list entirely:

# Clear all entries from TrustedHosts
Clear-Item WSMan:\localhost\Client\TrustedHosts -Force

# Verify that the value is completely empty
Get-Item WSMan:\localhost\Client\TrustedHosts

Managing the WinRM TrustedHosts list deliberately ensures reliable non-domain PowerShell remoting while preventing unauthorized credential exposure across enterprise Windows environments.

Get the best tech tips delivered straight to your inbox.

Join thousands of readers mastering Apple, Google, Microsoft, and Linux.