'PowerShellSdk: "The pipeline was not run because a pipeline is already running."
I'm building a remoting engine with PowerShell SDK. I canceled a remote PowerShell execution during debugging my code. Now I always get the following exception when invoking a remote PowerShell on the target server:
System.Management.Automation.PSInvalidOperationException: The pipeline was not run because a pipeline is already running. Pipelines cannot be run concurrently.
at System.Management.Automation.RemotePipeline.DoConcurrentCheck(Boolean syncCall)
at System.Management.Automation.RemoteRunspace.DoConcurrentCheckAndAddToRunningPipelines(RemotePipeline pipeline, Boolean syncCall)
at System.Management.Automation.RemotePipeline.InitPowerShell(Boolean syncCall, Boolean invokeAndDisconnect)
at System.Management.Automation.RemotePipeline.Invoke(IEnumerable input)
at System.Management.Automation.Runspaces.Pipeline.Invoke()
at System.Management.Automation.RemoteSessionStateProxy.SetVariable(String name, Object value)
at PowerShellRemoteExecutionEngine.PowerShellAbstraction.PowerShellFacade.RunScriptAsync(String script, Object[] parameter) in
My question: Does anyone know who to stop running remote pipelines via the PowerShell.SDK. I tried to figure it out via the PowerShell and Runspace classes, but didn't find a way to do it.
Of course I could restart the whole server, but I want that my code is able to get out of this situation.
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|
