I am facing a peculiar problem in executing chef knife commands for powershell remotely.
Command is executed successfully however the return code is 1 with an error.
10..x.x.x SESSIONNAME USERNAME ID STATE TYPE DEVICE
10..x.x.x >services 0 Disc
10..x.x.x console 1 Conn
10..x.x.x cloud360mssadmin 3 Disc
10..x.x.x rdp-tcp 65536 Listen
ERROR: Failed to execute command on 10.x.x.11 return code 1
this is what we are using the command.
%CPath% && knife winrm '%IP_Val%' --winrm-shell Powershell 'query session' -x %username% -p %password% -m