I'm trying to run remote commands on a computer named "spare". Attached the
error description.
Both machines (source and destination) runs WinXP SP2 fully patched (firewall
is off), PowerShell CTP and WinRM (KB936059).
PS > Invoke-Expression -ComputerName spare -command "get-process"
Invoke-Expression : [spare] The WS-Management service does not support the
request.
At line:1 char:18
+ Invoke-Expression <<<< -ComputerName spare -command "get-process"
PS > Invoke-Expression -ComputerName spare -command {get-process}
Invoke-Expression : Cannot evaluate parameter 'Command' because its argument
is specified as a script block and there is no input. A scriptblock cannot
be evaluated without input.
At line:1 char:47
+ Invoke-Expression -ComputerName spare -command <<<< {get-process}
I saw Jeffrey's comment on Richard's blog:
http://RichardSiddaway.spaces.live.com/Blog/cns!43CFA46A74CF3E96!921.entry
Jeffrey used a scriptblock on -command parameter. The help file shows that
I should pass a string value.
Should the help file be updated? Whats wrong with my command?
-----
Shay Levi
$cript Fanatic
http://scriptolog.blogspot.com
Hebrew weblog: http://blogs.microsoft.co.il/blogs/scriptfanatic
-Karl
I know others were succesfull with this command, and I wonder why I'm not
:-(
-----
Shay Levi
$cript Fanatic
http://scriptolog.blogspot.com
Hebrew weblog: http://blogs.microsoft.co.il/blogs/scriptfanatic
> invoke-expression in v1 worked right there in the same runspace. But
It is somehow possible that the server was named, winrm installed, then
the server renamed to "spare"?
Now, check what I get when I do the same below.
I tried this:
invoke-expression -computername localhost -command "get-process"
That worked. Then, for fun, modified my local hosts file, and added
"spare" as another name for my local system (using 127.0.0.1), and
retried the command.
I get this:
PSH> invoke-expression -computername spare -command "get-process"
Invoke-Expression : [spare] WinRM cannot process the request. An error
occured while using the following authentication
method: Kerberos. Possible causes are:
The user name or password specified are invalid.
Kerberos is used when no authentication method and no user name are
specified.
Kerberos does not accept a local user name.
The Service Principal Name (SPN) for the remote computer name and
port does not exist.
The client and remote computers are in different domains and there is
no trust between the two domains.
You may check the Event Viewer for events related to authentication.
To continue using the same authentication method, check and resolve
the issues above.
To use a different authentication method, specify a valid user name
and password and do one of the following: add the
destination computer to the TrustedHosts configuration setting for WinRM
or use HTTPS transport. You can get informatio
n about the WinRM configuration by running the following command: winrm
help config.
At line:1 char:18
+ invoke-expression <<<< -computername spare -command "get-process"
A friend of mine suggested to test it on two fresh installed machines. While
I think it'll probably work,
I don't think I can fresh install all my network clients, I want to be able
to solve it on exisiting machines.
Thanks again for the try!
-----
Shay Levi
$cript Fanatic
http://scriptolog.blogspot.com
Hebrew weblog: http://blogs.microsoft.co.il/blogs/scriptfanatic
> Shay Levi wrote:
>
>> Hi
>>
>> I'm trying to run remote commands on a computer named "spare".
>> Attached
>> the error description.
>> Both machines (source and destination) runs WinXP SP2 fully patched
>> (firewall is off), PowerShell CTP and WinRM (KB936059).
>> PS > Invoke-Expression -ComputerName spare -command "get-process"
>>
>> Invoke-Expression : [spare] The WS-Management service does not
>> support
>> the request.
>> At line:1 char:18
>> + Invoke-Expression <<<< -ComputerName spare -command "get-process"
> It is somehow possible that the server was named, winrm installed,
> then the server renamed to "spare"?
>
> Now, check what I get when I do the same below.
>
> I tried this:
> invoke-expression -computername localhost -command "get-process"
> That worked. Then, for fun, modified my local hosts file, and added
> "spare" as another name for my local system (using 127.0.0.1), and
> retried the command.
>
> I get this:
>
PSH>> invoke-expression -computername spare -command "get-process"
PSH>>
First command looks ok. Does it work if you choose the name of your current
computer (ie the one you're connecting to 'spare' from in the command)? eg
invoke-expression -ComputerName nameofthiscomputer -command "get-process"
I get a 'winrshost.exe' box popping up here, which then returns the results
to powershell
I think it's just calling 'winrs' under the hood, so may be worth trying
these commands too from a cmd.exe prompt
winrs -r:spare "powershell -command get-process"
winrs -r:nameofthiscomputer "powershell -command get-process"
Also check your winrm settings with (cmd.exe prompt)
winrm get winrm/config
Having said that, I just tried it here, with 2 XP machines, and got an
'Access is denied' message on a connected workgroup computer (here'jon3') ,
whereas it works ok with the local machine 'jon2' ).
PS (1) > invoke-expression -ComputerName jon3 -Command get-process
Invoke-Expression : [jon3] Access is denied.
At line:1 char:18
+ invoke-expression <<<< -ComputerName jon3 -Command get-process
PS (2) > invoke-expression -ComputerName jon2 -Command get-process
Handles NPM(K) PM(K) WS(K) VM(M) CPU(s) Id ProcessName
------- ------ ----- ----- ----- ------ -- -----------
106 5 1040 3196 32 0.03 2812 alg
.......
The second command works here, if you omit the '-command' (ie having it just
as a positional parameter, rather than named) eg
invoke-expression -ComputerName jon2 {get-process}
So that may just be a bug (?)
Hope that helps a bit, anyhow.
--
Jon
Thanks for the comprehensive replay. Here's a series of tests I ran on both
machines:
>> invoke-expression -ComputerName nameofthiscomputer -command "get-process"
PS > invoke-expression -ComputerName ShayL -command "get-process"
Invoke-Expression : [ShayL] The WS-Management service does not support the
request.
At line:1 char:18
+ invoke-expression <<<< -ComputerName ShayL -command "get-process"
It's not working even with my local machine FQDN, no DOS window.
From the DOS command prompt (cmd.exe) I ran:
C:\WINDOWS> winrs -r:spare "powershell -command get-process"
Winrs error:The WS-Management service does not support the request.
C:\WINDOWS>winrs -r:ShayL "powershell -command get-process"
Winrs error:The WS-Management service does not support the request.
Running winrm /quickconfig on both machines:
C:\WINDOWS>winrm /quickconfig
WinRM already is set up for remote management on this machine.
# Determines if a WS-Management implementation is running on the remote machine.
# Same error on local machine
C:\WINDOWS>winrm identify -r:spare
WSManFault
Message = The WS-Management service does not support the request.
Error number: -2144108428 0x80338074
The service returned a response that indicates that the method is unsupported.
I found Marco reply for a similar post. I do have IIs running on both machines.
"Do you have IIS running by any chance? There seems to be an issue with
IIS and winrm running together on XP."
Can someone confirm that?
-----
Shay Levi
$cript Fanatic
http://scriptolog.blogspot.com
Hebrew weblog: http://blogs.microsoft.co.il/blogs/scriptfanatic
> "Shay Levi" <n...@addre.ss> wrote in message
OK, I can confirm there is an issue. ;-)
A KB was supposed to be done up by the Microsoft winrm team. I'll
follow up.
Marco
--
Microsoft MVP - Windows PowerShell
http://www.microsoft.com/mvp
PowerGadgets MVP
http://www.powergadgets.com/mvp
Oh... Just stop IIS, then restart winrm and all should be well. Or
make winrm use something other than port 80.
-----
Shay Levi
$cript Fanatic
http://scriptolog.blogspot.com
Hebrew weblog: http://blogs.microsoft.co.il/blogs/scriptfanatic
> Marco Shaw [MVP] wrote:
>
>>> "Do you have IIS running by any chance? There seems to be an issue
>>> with IIS and winrm running together on XP."
>>>
>>> Can someone confirm that?
>>>
>> OK, I can confirm there is an issue. ;-)
>>
>> A KB was supposed to be done up by the Microsoft winrm team. I'll
>> follow up.
>>
>> Marco
>>
> Oh... Just stop IIS, then restart winrm and all should be well. Or
> make winrm use something other than port 80.
>
> Marco
>