I followed Matt Wrock's very helpful guide: Understanding and troubleshooting WinRM connection and authentication, (http://www.hurryupandwait.io/blog/understanding-and-troubleshooting-winrm-connection-and-authentication-a-thrill-seekers-guide-to-adventure) and I was able to set up an SSL connection on my remote machine, which I verified using:
Test-WSMan -ComputerName "My DNS" -UseSSL
... which returned a non-error message. And I can also connect from powershell:
Enter-PSSession -ComputerName "My DNS" -Credential $cred -UseSSL
However, when I run the following python code:
import winrm
s = winrm.Session('My DNS', auth=('Remote Username', 'Remote Password'), transport='ssl')
r = s.run_cmd('ipconfig', ['/all'])
... I get receive the following error code: winrm.exceptions.WinRMTransportError: 500 WinRMTransport. [SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed (_ssl.c:590)
The certificate verify failed error makes me think that I improperly configured the SSL configuration; however, I seem to be able to connect from Powershell.
Can anybody tell me what I am doing wrong or how to properly connect using ssl?
Thanks for your time
Problem found with the pywinrm version.
Use python version 2.7.10 and pywinrm version (0.1.1). It Worked fine without any error.
Latest version forcibly verifying the ssl certificate even we put exception handlers to ignore certificate in the script.