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.
I have tried setting the trusted hosts on the remote computer, and restarted the service but it doesn't seem to be doing anything.
For example, on the remote machine:
winrm set winrm/config/client '@{TrustedHosts="someIncorrectName"}'
I then restart the winrm service.
How come I can still run the remote commands from my laptop? Shouldn't it prevent the command from being executed?
I'm running the command the following way:
Invoke-Command -cn remoteMachine -Credential $cred -scriptblock {get-process}
Where $cred was generated using get-credential domain/username.
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.
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).
What am I doing wrong?
Thanks