Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Got WinRMOperationTimeoutError when using python winrm library to call a local powershell script on a windows server #323

Open
condescendent opened this issue Jul 22, 2021 · 2 comments

Comments

@condescendent
Copy link

I am trying to user winrm library to call a local powershell script to stop MS SQL server engine service from a Lambda function. I got the below error. The connection was established successfully.

The log for establishing connection:

Establishing connection to 10.251.3.22

Connection established

The error I got after the above two logs.

[ERROR] WinRMOperationTimeoutError
Traceback (most recent call last):
  File "/var/task/lambda_function.py", line 237, in lambda_handler
    result = session.run_ps('c:\shutdown_script.ps1')
  File "/var/task/winrm/__init__.py", line 52, in run_ps
    rs = self.run_cmd('powershell -encodedcommand {0}'.format(encoded_ps))
  File "/var/task/winrm/__init__.py", line 39, in run_cmd
    shell_id = self.protocol.open_shell()
  File "/var/task/winrm/protocol.py", line 166, in open_shell
    res = self.send_message(xmltodict.unparse(req))
  File "/var/task/winrm/protocol.py", line 265, in send_message
    raise WinRMOperationTimeoutError()
@condescendent
Copy link
Author

Anyone can help me with troubleshoot this error. I have been stuck in here for over one month. Any help will be great appreciated.

@jborean93
Copy link
Collaborator

You will have to look at the Windows host event logs to find out why it's not returning the shell creation response. For some reason it's just blocking until the operation timeout is just doing nothing causing the timeout.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants