none
System.Management.Automation.Runspaces.InvalidRunspacePoolStateException: Cannot perform operation because the runspace pool is not in the 'Opened' state. The current state is 'Broken'. RRS feed

  • Question

  • Hi All,

    I have a c# application which connects to exchange 2010 using remote runspace mechanism as mentioned here http://blogs.technet.com/b/exchange/archive/2009/11/02/3408653.aspx

    But I do not create the runspace everytime I need to execute a command. I create it only once and use it forever.

    After sometime, my c# application throws the above error. Can you please let me know what could be the issue ?

    I can provide more information. Thanks.


    /M

    Saturday, December 15, 2012 3:23 AM

Answers

  • I would suggest you have a read of http://powershell.com/cs/media/p/4908.aspx which deals with a number of issue that can happen with remote powershell.  eg quoting "Although Windows PowerShell Remoting really acts like a web service and uses stateless connections, the server maintains a heartbeat to the client. If the network connection between client and server is lost for more than approximately three minutes, the server discards the session. This is controlled by a WSMan setting called IdleTimeout:"

    What you should be doing is check the connection status via the RunspaceStateInfo

    Cheers
    Glen

    • Marked as answer by user5796 Monday, December 17, 2012 8:04 AM
    Monday, December 17, 2012 6:41 AM

All replies

  • I would suggest you have a read of http://powershell.com/cs/media/p/4908.aspx which deals with a number of issue that can happen with remote powershell.  eg quoting "Although Windows PowerShell Remoting really acts like a web service and uses stateless connections, the server maintains a heartbeat to the client. If the network connection between client and server is lost for more than approximately three minutes, the server discards the session. This is controlled by a WSMan setting called IdleTimeout:"

    What you should be doing is check the connection status via the RunspaceStateInfo

    Cheers
    Glen

    • Marked as answer by user5796 Monday, December 17, 2012 8:04 AM
    Monday, December 17, 2012 6:41 AM
  • Thanks Glen.

    Yes, I have to either check the RunspaceStateInfo or create runspace use it, dispose it for every operation. Thanks for the reply.


    /M

    Monday, December 17, 2012 8:04 AM