Add TrustedHosts entry using PowerShell

Add TrustedHosts entry using PowerShell

Q. How can I easily add entries to TrustedHosts using PowerShell?

A. TrustedHosts enable management via WS-Management of machines in a workgroup or different domain that have no trust relationship. To add machines to TrustedHosts use the following PowerShell which adds all machine in savilltech.net to the existing hosts.

$trusthosts = (Get-Item -Path WSMan:\localhost\Client\TrustedHosts).Value
Set-Item -Path WSMan:\localhost\Client\TrustedHosts "$trusthosts, *.savilltech.net" -Force

 

Hide comments

Comments

  • Allowed HTML tags: <em> <strong> <blockquote> <br> <p>

Plain text

  • No HTML tags allowed.
  • Web page addresses and e-mail addresses turn into links automatically.
  • Lines and paragraphs break automatically.
Publish