In our research, we have found the following information about this error:
- Powershell script is invoked from the Aisera Remote Executor.
- As part of connection to Powershell to get the connection going we use Xebialabs/overthere
- Which in turn runs WinRM to do its validation.
- The WinRM system tries to connect and validate where we see the below failure.
2024-11-27 07:56:24.812 [pool-2-thread-3] INFO c.a.a.w.c.WindowsSystemCapabilityProvider - CapabilityProvider configuration: {tenantId=cisco, externalSystemId=29, endpoint=wilthias-test-endpoint, password=password, host=WIN-SA2ABVG178E, useRemoteExecutor=false, authType=Basic, username=user1, useUserCredentials=false, userId=12345}
2024-11-27 07:56:24.812 [pool-2-thread-3] INFO c.a.action.common.base.ActionBase - Starting WindowsPowershellGenericAction.doExecution...
2024-11-27 07:56:24.812 [pool-2-thread-3] INFO c.a.a.r.f.WindowsPowershellGenericAction - WindowsPowershellGenericAction.doExecution
2024-11-27 07:56:24.812 [pool-2-thread-3] INFO c.a.a.r.f.WindowsPowershellGenericAction - Running first script
2024-11-27 07:56:24.812 [pool-2-thread-3] INFO c.a.a.w.c.WindowsSystemCapabilityProvider - Running PowerShell script "powershell c:\opt\testwill\testscript.ps1" on host PowerShellInputs(host=WIN-SA2ABVG178E, username=user1, password=password, script=powershell c:\opt\testwill\testscript.ps1, connectionType=WINRM_INTERNAL, timeLimited=null)...
2024-11-27 07:56:26.115 [pool-2-thread-3] ERROR c.a.common.PowerShellScriptService - Error during connection: com.xebialabs.overthere.winrm.WinRmRuntimeIOException: Unexpected HTTP response on http://WIN-SA2ABVG178E:5985/wsman: (401) at com.xebialabs.overthere.winrm.WinRmClient.doSendRequest(WinRmClient.java:428) at com.xebialabs.overthere.winrm.WinRmClient.sendRequest(WinRmClient.java:343) at com.xebialabs.overthere.winrm.WinRmClient.createShell(WinRmClient.java:147) at com.xebialabs.overthere.winrm.WinRmConnection.startProcess(WinRmConnection.java:114) at com.xebialabs.overthere.cifs.CifsProcessConnection.startProcess(CifsProcessConnection.java:66) at com.xebialabs.overthere.cifs.winrm.CifsWinRmConnection.startProcess(CifsWinRmConnection.java:52) at com.xebialabs.overthere.spi.BaseOverthereConnection.execute(BaseOverthereConnection.java:272) at com.aisera.common.PowerShellScriptService.executePowerShellScript(PowerShellScriptService.java:34)
Based on the below link/doc we have a few things that can be done to mitigate this issue --
Can you check these and let me know if any of these might apply to our issue?
WinRM command fails with a 401 response code
Multiple causes can lead to this error message:
-
The Kerberos ticket is not accepted by the remote host:
-
Did you set up the correct service principal names (SPNs) as described in the section on Kerberos setup for remote hosts? The hostname is case insenstive, but it has to be the same as the one used in the address connection options, i.e. a simple hostname or a fully qualified domain name. Domain policies may prevent the Windows Management Service from creating the required SPNs. See this blog by LazyJeff for more information.
-
Has the reverse DNS of the remote host been set up correctly? See Principal names and DNS for more information. Please note that the rdns
option is not available in Java's Kerberos implementation.
-
The WinRM service is not set up to accept unencrypted traffic. Did you execute step #8 of the host setup for WinRM?
-
The user is not allowed to log in. Did you uncheck the "User must change password at next logon" checkbox when you created the user in Windows?
-
The user is not allowed to perform a WinRM command. Did you grant the user (local) administrative privileges?