'Not able to connect remote windows server using python pywinrm library, ConnectTimeoutError occurred
I'm facing an issue while making the connectivity with windows server using python winrm package.
can you please help me to resolve this issue. I'm using my private ip of windows server and its password ,below given data is a dummy.
import winrm
def main() :
ip = "191.165.8.33"
password = "12421"
username = "administrator"
try:
print("Establisshing the connectivity to %s" % ip)
session = winrm.Session(ip, auth=(username, password))
print(session)
result = session.run_ps("hostname")
print(result.std_out)
except Exception as e:
print("----"*20)
print(e)
print('something went wrong')
if __name__ == "__main__":
main()
By using the above simple code snippet, I'm getting the below error.
Traceback (most recent call last):
resp = conn.urlopen(
File "/Users/akshaysingh/opt/anaconda3/lib/python3.8/site-packages/urllib3/connectionpool.py", line 755, in urlopen
retries = retries.increment(
File "/Users/akshaysingh/opt/anaconda3/lib/python3.8/site-packages/urllib3/util/retry.py", line 574, in increment
raise MaxRetryError(_pool, url, error or ResponseError(cause))
urllib3.exceptions.MaxRetryError: HTTPConnectionPool(host='191.165.8.33', port=5985): Max retries exceeded with url: /wsman (Caused by ConnectTimeoutError(<urllib3.connection.HTTPConnection object at 0x7f8678c2fb80>, 'Connection to 191.165.8.33 timed out. (connect timeout=30)'))
Any solution/suggestion?
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|
