Skip to content

Instantly share code, notes, and snippets.

@rbramwell
Forked from MattHodge/ConfigureWsMan.ps1
Created April 20, 2016 00:19
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save rbramwell/75e868a942d7d21b548cb0ab1c86bd1a to your computer and use it in GitHub Desktop.
Save rbramwell/75e868a942d7d21b548cb0ab1c86bd1a to your computer and use it in GitHub Desktop.
# Get a list of trusted hosts
Get-Item WSMan:\localhost\Client\TrustedHosts
# Note that these commands don't create a list of trusted hosts, it simply replaces the trusted host with what you set via the command. If you need to add multiple hosts, they need to be comma seperated
# Trust all computers in a domain
Set-Item WSMan:\localhost\Client\TrustedHosts *.contoso.com
# Turst a single machine
Set-Item WSMan:\localhost\Client\TrustedHosts -Value myserver
# Add another single machine
$trustedHosts = (Get-Item WSMan:\localhost\Client\TrustedHosts).value
Set-Item WSMan:\localhost\Client\TrustedHosts -Value "$trustedHosts, mynextserver"
# Trust an IP address range
Set-Item WSMan:\localhost\Client\TrustedHosts -value 192.168.10.*
# Trust all remote machines (not recommended)
Set-Item WSMan:\localhost\Client\TrustedHosts *
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment