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.
> %CPath% && knife winrm '%IP_Val%' --winrm-shell Powershell 'query session' -x %username% -p %password% -m
%IPAddress% SESSIONNAME USERNAME ID STATE TYPE DEVICE
%IPAddress% >services 0 Disc
%IPAddress% console 1 Conn
%IPAddress% %Username% 3 Disc
%IPAddress% rdp-tcp 65536 Listen
ERROR: Failed to execute command on %IPAddress% return code 1