-
Notifications
You must be signed in to change notification settings - Fork 51
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
WSManFaultError: Code: 2150858843, Windows Remote Shell Shell ID #22
Comments
I've been testing some more and this seems to be a connection clean-up issue. I noticed that the script fails once every time I save it, then runs cleanly until I save the script again. Perhaps O365 cleans up the RunspacePool after my failed attempt and then lets the same command execute again and again. I'm trying to figure out the WSMan disconnect() and delete() methods but don't know what resource_uri I should provide.
|
If there was an error in creating the Runspace Pool that wasn't returned back to pypsrp then it will blindly send the next message which is a receive message with the ShellID it had set. If this ShellID does not exist then you would get the message you put here. Typically on a failure scenario, the server will clean up any resources and hopefully logs the error in the event logs. I don't have an exchange host or Office 365 account to test this against so I unfortunately can't help you too much. Every execution will generate a unique id for the shell/runspace so there should not be any collisions when it comes to the ID.
For PSRP, the resource URI is always |
Reproduced the problem, and played with it a little bit. I think I know what is the problem. Receive message is sent too fast. It helps to add a little sleep before receive. Maybe better to add retries on receiving. |
I have two Python scripts using pypsrp. The first script I created works fine. The second script - even when calling the same cmdlet as the first, returns a ShellID exception.
I get this result:
The text was updated successfully, but these errors were encountered: