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

How can I invoke a remote command with powershell. Both computers are in the same network and I can have a Remote desktop connection from one to another.

EDIT: Both machine have Powershell V2, Windows Server 2008.
The task I try to accomplish is to restart Velocity on the second and third computer from the first one. Comandlet that is doing this is restart-cachehost.

share|improve this question
Can you be more specific about what you are trying to do? – Doug Chase Sep 3 '09 at 17:36
Is PowerShell installed on both computers? V1 or V2? – Doug Chase Sep 3 '09 at 17:37
up vote 5 down vote accepted

You need use Powershell 2.0 with WinRM on either XP SP3, Win2k3 SP2, Vista, Windows 7 or Windows Server 2008.

You can get the latest build of Powershell 2.0 here:

And a quick start guide:

Note the default ports of WinRM have changed:

share|improve this answer
Thanks. I'll try it out. – Jenea Sep 4 '09 at 7:03

After you have followed fenster's directions for setup, the actual remote execution command is simply:

Invoke-Command <remote_computer_name(s)> { Restart-CacheHost }

or if typing interactively, you can use the icm alias

$computers = 'server1','server2'
icm $computers { Restart-CacheHost }
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.