Sam Perrin TIL Blog

PowerShell - Add TrustedHosts

October 07, 2019

Add IP address to TrustedHosts

Set-Item WSMan:\localhost\Client\TrustedHosts -Value ""

Add entire subnet to TrustedHosts using wildcard *

Set-Item WSMan:\localhost\Client\TrustedHosts -Value "172.16.1.*"

The above commands overwrite the TrustedHosts with the value specified, you can add to existing by using the -Concatenate parameter

Set-item WSMan:\localhost\Client\TrustedHosts -Value "" -Concatenate Set-item WSMan:\localhost\Client\TrustedHosts -Value "172.16.1.*" -Concatenate

Sam Perrin

Written by Sam Perrin who loves all things Automation related! You should follow him on Twitter