I’m using the Powershell winrm invoke ExecuteShellCommand method, to test the output of a simple shell command:
echo "+ apigee-service apigee-cassandra status"
When running the Shell Command directly on the SSH Terminal, i’m getting the correct output:
$ echo "+ apigee-service apigee-cassandra status" + apigee-service apigee-cassandra status
But when running the command using the winrm invoke ExecuteShellCommand method, i’m only getting the + sign in the StdOut field:
C:\Users\testuser\Desktop\Testshellcommand.ps1
SCX_OperatingSystem_OUTPUT
ReturnValue = TRUE
ReturnCode = 0
StdOut = +
StdErr
This is my XML Configuration File:
<p:ExecuteShellCommand_INPUT xmlns:p="http://schemas.microsoft.com/wbem/wscim/1/cim-schema/2/SCX_OperatingSystem"> <p:Command>echo "+ apigee-service apigee-cassandra status"</p:Command> <p:timeout>60</p:timeout> </p:ExecuteShellCommand_INPUT>
What am i missing here?
I did noticed,
That by removing the spaces in the command written in XML Configuration File, i’m getting more results in the StdOut field:
C:\Users\testuser\Desktop\Testshellcommand.ps1
SCX_OperatingSystem_OUTPUT
ReturnValue = TRUE
ReturnCode = 0
StdOut = +apigee-serviceapigee-cassandrastatus
StdErr