I am trying to use powershell remote execution on a EC2 server. I have enabled Windows Remote Management on the Server and configured WRM with -quickconfigure.
However when run the example:
$Cred=Get-Credential Invoke-Command -Authentication Negotiate -Credential $Cred -ComputerName <servername>.eu-west-1.compute.amazonaws.com -ScriptBlock {Get-Culture}
I get the error:
Connecting to remote server failed with the following error message : The WinRM client cannot complete the operation within the time specified. Check if the machine name is valid and is reachable over the network and firewall exception for Windows Remote Management service is enabled. For more information, see the about_Remote_Troubleshooting Help topic. + CategoryInfo : OpenError: (:) [], PSRemotingTransportException + FullyQualifiedErrorId : PSSessionStateBroken
I read here in a question that the Server and client both have to be on same domain. Is that really necessary? Do we have other options to interact with non-domain machine using Powershell?
Note: I am aware of PSExec tool.