Modify TrustedHosts with PowerShell

Modify TrustedHosts with PowerShell

Q. How can I modify TrustedHosts using PowerShell?

A. To modify TrustedHosts using PowerShell leverage the WSMan provider and set the TrustedHosts value under localhost\Client. For example to set TrustedHosts to every machine in your domain namespace use:

Set-Item -Path WSMan:\localhost\Client\TrustedHosts -Value '*.savilltech.net'

To set to have no trusted hosts use:

Set-Item -Path WSMan:\localhost\Client\TrustedHosts -Value ''

To avoid the prompt to make the change add -Force, for example:

Set-Item -Path WSMan:\localhost\Client\TrustedHosts -Value '' -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