WinRM discovery for windows server is throwing error and the credential gets timed out.

Ayush10
Tera Contributor

Dear All,

 

We are trying to configure and discover Windows server using WinRM over WMI.

The below parameters are enabled on the Mid Server :-

mid.windows.management_protocol - WinRM

mid.powershell_api.winrm.use_ssl - true

mid.powershell_api.winrm.remote_https_port - 5985

mid.powershell_api.winrm.remote_https_port - 5986

 

MID Server Properties:-

glide.discovery.windows.use_legacy_wmi- false

glide.powershell.use_powershell - true

mid.use_legacy_wmi - false

 

When we are trying to run the test the credential from ServiceNow instance we are getting "credential timed out error".

As part of testing , from Mid server to the host the Enter-PS Session is running successfully and Test-WsMan command is also running successfully.

The error found in logs is -

response code 404 over port 5985 over winrm protocol.

PowerShellSessionPoolKey[target:X.X.X.X&port:135&fixed_cred:&tag:&type:winrm&noCredFallback:true&configurationName:]

 

Expedited:MultiProbe-X.X.X.X) [MIDPowerShellUtils:118] 2026-06-21 14:02:34 Running test script: test-wsman -computer X.X.X.X -port 5985 -ErrorAction stop

 

 

Kindly provide some input if anyone has implemented WinRM for discovery of Windows server

2 REPLIES 2

Tanushree Maiti
Tera Patron

Hi @Ayush10 

 

Refer:

https://www.servicenow.com/community/itom-forum/port-scanning-issue-active-couldn-t-classify-no-wmi-...

KB0687786 Error WinRM client cannot process the request. Use winrm.cmd to configure TrustedHost. 

 

 

Please Accept the solution if it assisted you with your question & Mark this response as Helpful.
Regards
Tanushree Maiti
ServiceNow Technical Architect
LinkedIn: https://www.linkedin.com/in/tanushreemaiti

pr8172510
Tera Guru

Hi @Ayush10,

 The 404 response is the key clue here.


Your configuration shows mid.powershell_api.winrm.use_ssl = true


but the logs indicate Discovery is testing Port 5985 (HTTP)


If SSL is enabled, ServiceNow expects a valid WinRM HTTPS listener on port 5986. A 404 response typically indicates the WinRM listener/endpoint configuration does not match the MID Server configuration.


 check:

  • Verify the WinRM listener winrm enumerate winrm/config/listener

  • Confirm HTTPS listener is configured on 5986.

  • Verify the certificate bound to the HTTPS listener is valid.

  • Ensure the MID Server properties and WinRM listener configuration are consistent (HTTP vs HTTPS).

  • Review WinRM Operational Logs on the target server.


Since Test-WsMan and Enter-PSSession are working from the MID Server, connectivity and credentials are likely not the issue.
The problem is most likely with the WinRM listener/endpoint configuration that Discovery is attempting to use.