- Install .Net 2.0 SP1
- Install Powershell for Windows 2k3 64bit.
Config powershell:
- Start Windows PowerShell with the "Run as administrator" option.
- On server: enable-psremoting
- On server: Set-ExecutionPolicy Unrestricted
- On server: Set-Item wsman:\localhost\client\trustedhosts * (allows any computer to connect)
- On server: Restart-Service WinRM
- On client: Set-ExecutionPolicy Unrestricted
- On client: Set-Item wsman:\localhost\client\trustedhosts * (allows connections to any server)
- On client: Restart-Service WinRM
Syntax command for examples:
- Run in command line - Command [IP server] [service name/process name]
Example 1:
Run command line to stop process on local or remote server:
I earlier authored http://techibee.com/powershell/kill-a-process-on-remote-machine-using-powershell-remoting/262 to
demostrate how to kill a process on remote computer. Today when my
colleague asked for it, I revisited this article again and felt we can
do in much better and easy way.
Say if the computers are in a text file called comps.txt, the script follows like this.
PS> $svc = Get-Service -Name wuauserv -ComputerName Server1
PS> Stop-Service -InputObject $svc