Server Fault is a question and answer site for system and network administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I'm having trouble administering a Windows 2k8 Server SP2 instance (hosted on EC2) with powershell from my Windows 7 client. When I try to run:

Invoke-Command {Get-Service} -ComputerName

I receive the following 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.

On the server I have: (1) Connected with RDP (the server is reachable), and (2) run Enable-PSRemoting

On my client I have: (1) Added the EC2 instance to TrustedHosts

I've also tried running the above command on the server with the Windows firewall completely disabled, but that didn't solve the problem either. I've also verified there's a firewall exception for Windows Remote Management.

The tutorial I've been referencing is:

share|improve this question
Sorry for the huge delay in any response. Do you still need help? – Marco Shaw Dec 18 '10 at 21:52
Could you post your answer if you ever solved this problem? – Caleb Apr 12 '11 at 15:12

On EC2, you need to open port 5985, the default WinRM remoting port on your security group so that you can connect to the instance from your IP address.

On the instance in the cloud, do a:

winrm quickconfig -quiet

On your workstation:

set-item wsman:\localhost\Client\TrustedHosts -value "*" -force
Invoke-Command {Get-Service} -ComputerName <hostname> -Credential administrator

And that should get you going.

share|improve this answer

Both of those machines must be on the same domain. I don't see how you have accomplished that. "On my client I have: (1) Added the EC2 instance to TrustedHosts." does not suffice. You would need to add the EC2 server to your ground based Domain, or have the EC2 server be the domain controller for that Windows7 client.

Another approach to "managing" that EC2 server from the ground would be to utilize PsExec.exe from Microsoft's "SysInternals" collection of utilities. You would find that gem in their "PsTools" bundle of free tools. So, on the Microsoft download site appropriate for you, search for PsTools and PsExec is in there.

PsExec let's you remotely control machines that are outside of your domain.

share|improve this answer

Just because RDP is authorized doesn't mean other services are. You have to allow access to ports on a target system port by port using ec2-authorize. What port does powershell use to talk to a target system? Did you authorize that port?

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.