I am trying to execute a powershell script on a remote server from my local machine, however I get an error.
Here is the full error message:
Connecting to remote server failed with the following error message : The WinRM client cannot process the request.
If the authentication scheme is different from Kerberos, or if the client computer is not joined to a domain, then HTTPS transport must be used or the
destination machine must be added to the TrustedHosts configuration setting. Use winrm.cmd to configure TrustedHosts. Note that computers in the TrustedHosts
list might not be authenticated. You can get more information about that by running the following command: winrm help config. For more information, see the
about_Remote_Troubleshooting Help topic.
- CategoryInfo : OpenError: (:String) [], PSRemotingTransportException
- FullyQualifiedErrorId : ServerNotTrusted,PSSessionStateBroken
Now this is a common error and I found lots of information on it already, however none lead to a successful connection. What I have done:
- In an elevated PowerShell window
- Started WinRM on both machines
- Checked the port where the remote machine is listening with:
winrm enumerate winrm/config/listener
- Added the remote machine to my trusted hosts on the local machine
- All done with administrator privileges
- Both machines are on the same domain
The remote machine is a VM hosted on Azure, but that should not matter. The ports are not getting blocked on the firewall either.
I am really not sure what else to check for right now. Any help would be appreciated!