zenchild/WinRM — Issue #18: Powershell isn't in the path by default (on Win2008 at least)
Author: hh
Created: 2011-12-12 23:19:33+00:00
State: open

Against a fresh Windows Server 2008 R2 w/SP1 from http://technet.microsoft.com/en-us/evalcenter/dd459137.aspx (which includes powershell v2.0)

{{{
>> winrm.cmd ("powershell") {|stdout,stderr| puts stderr}
'powershell' is not recognized as an internal or external command,
operable program or batch file.
=> {:data=>[{:stderr=>"'powershell' is not recognized as an internal or external command,\r\noperable program or batch file.\r\n"}], :exitcode=>1}
}}}

{{{
>> winrm.run_powershell_script('echo foo')
=> {:data=>[{:stderr=>"'powershell' is not recognized as an internal or external command,\r\noperable program or batch file.\r\n"}], :ex
itcode=>1}
}}}

{{{
>> winrm.cmd ("%systemroot%\\system32\\WindowsPowerShell\\v1.0\\Powershell.exe -c echo $PSVersionTable::PSVersion") {|stdout,stderr| put
s stdout}

Major Minor Build Revision

----- ----- ----- --------
2 0 -1 -1

=> {:data=>[{:stdout=>"\r\n"}, {:stdout=>"Major Minor Build Revision"}, {:stdout=>"\r\n----- ----- ----- --------\r\n2 0
-1 -1 \r\n\r\n\r\n"}], :exitcode=>0}
}}}