2

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
Sergey Nudnov
  • 833
  • 6
  • 12
goe
  • 141
  • 4

1 Answers1

2

Looks like its something to do with WinRM. I replaced "query session" with "qwinsta" which solved the problem.

Need to check RCA on Winrm

goe
  • 141
  • 4