Hi there, I am using pypsrp lib to connect to windows from WinRM over HTTPS. following is the code:
from pypsrp.shell import Process, SignalCode, WinRS
from pypsrp.wsman import WSMan
wsman = WSMan("x.x.x.x", ssl=True, auth="basic", encryption="auto",
username="test", password="test")
with wsman, WinRS(wsman) as shell:
process = Process(shell, "dir")
process.invoke()
process.signal(SignalCode.CTRL_C)
# execute a process with arguments in the background
process = Process(shell, "powershell", ["gci", "$pwd"])
process.begin_invoke() # start the invocation and return immediately
process.poll_invoke() # update the output stream
process.end_invoke() # finally wait until the process is finished
process.signal(SignalCode.CTRL_C)
but i am getting following error:
requests.exceptions.SSLError: HTTPSConnectionPool(host='x.x.x.x', port=5986): Max retries exceeded with url: /wsman (Caused by SSLError(SSLCertVerificationError(1, '[SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed: self signed certificate (_ssl.c:997)')))
But I am able to connect to remote machine using powershell from WinRM using following command:
$session = New-PSSession -ComputerName x.x.x.x -Credential $credential -UseSSL -SessionOption $so -Authentication Basic
Please help me debugging.
tagging @oak edge because the is owner of pypsrp lib. 🙂