title: Powershell winrm Trusted Hosts not working
body: <p>I am trying to set up remote management on a few machines. I can successfully execute commands on the remote machine from my computer, but I don't want anyone to be able to do so.</p>
  
  <p>I have tried setting the trusted hosts on the remote computer, and restarted the service but it doesn't seem to be doing anything.</p>
  
  <p>For example, on the remote machine:</p>
  
  <pre><code> winrm set winrm/config/client '@{TrustedHosts="someIncorrectName"}'
  </code></pre>
  
  <p>I then restart the winrm service.</p>
  
  <p>How come I can still run the remote commands from my laptop? Shouldn't it prevent the command from being executed?</p>
  
  <p>I'm running the command the following way: </p>
  
  <pre><code>Invoke-Command -cn remoteMachine -Credential $cred -scriptblock {get-process}
  </code></pre>
  
  <p>Where $cred was generated using get-credential domain/username.</p>
  
  <p>I have read a few things about TrustedHosts, and they seem to give conflicting reports as to what it does. Some people seem to say that it prevents commands from being executed on computers not listed in the Trusted Hosts list. Others say it's a list of computers that can run commands on that machine.</p>
  
  <p>MSDN says: "Specifies the list of remote computers that are trusted." That seems to imply that it is the second option (a list of computers that can execute commands on the machine).</p>
  
  <p>What am I doing wrong?</p>
  
  <p>Thanks</p>