Wednesday, December 5, 2007

PowerShell remoting on XP and IIS

 

In order to use remoting in PowerShell CTP, all machines should have WinRM (KB936059) and PowerShell CTP installed. After the installation you should run the "Configure-Wsman.ps1" script (resides in the PowerShell home directory). The scripts configures WSMan to enable PowerShell remoting.

 

PS > & $pshome\Configure-Wsman.ps1

 

After the installation, the winrm service is not running (stopped state) so you should start it manually.

 

PS > get-service winrm

Status   Name               DisplayName
------   ----                     -----------
Stopped WinRM             Windows Remote Management (WS-Manag...

 

PS > get-service winrm | start-service

 

To make it load automatically when Windows starts:

PS > Set-Service winrm -StartupType automatic

 

Then I tried to run a command :

PS > Invoke-Expression -ComputerName  computer -Command Get-Process

 

It returned an error

Invoke-Expression : [computer] The WS-Management service does not support the
request.
At line:1 char:18
+ Invoke-Expression <<<< -ComputerName spare -command "get-process"

 

I posted a question in the PowerShell newsgroup and eventually the problem found with help from Marco Shaw.

If you have IIs installed on the machines your installed PowerShell CTP then there is a collision between WinRM port and IIs port.

To solve it temporary, stop the w3svc service and restart winrm service, or try to change the port setings for winrm.

There should be a public KB article from Microsoft on this issue somewhere soon.

No comments: