// Wait for incoming commands, invoke as they arrive
This approach works fine, unless, as in a particular environment, the heartbeat mechanism between the remote powershell and the server
(every 3-4 minutes, as we understand it) fails for whatever reason. In this case, an exception is thrown trying to execute a subsequent provisioning command: << Exception calling "PromptForCredential" with "4" argument(s): "Cannot invoke
this function because the current host does not implement it." >>
When this happens, we simply establish a new powershell session using the code above, and all is well, except that each time this occurs,
the process eats up an additional 25-50 MB of memory. We’ve tried calling combinations of powershell.Dispose(), powershell = null, _r.Dispose(), _r = null, System.GC.Collect() and “Remove-PSSession” to no avail.
Our question, then, is twofold: a) Is there some other way to free up the memory used by the original connection, and/or b) Is there
some way to “awaken” the original powershell session when the heartbeat has failed, to avoid having to create a new session?
Thanks in advance for any ideas.
Thursday, August 26, 2010 8:30 PM
Microsoft is conducting an online survey to understand your opinion of the Msdn Web site. If you choose to participate, the online survey will be presented to you when you leave the Msdn Web site.