PSHELL and @PSHELL fail the first time in a new TCC.

May 20, 2008
9,425
63
Syracuse, NY, USA
Here's a newly started-TCC.
Code:
v:\> pshell /s 'foo'
PSHELL: System.Management.Automation.PSInvalidOperationException : The pipeline was not run because a pipeline is already running. Pipelines cannot be run concurrently.

v:\> pshell /s 'foo'
foo
Here's another newly-started TCC.
Code:
v:\> echo %@pshell['foo']
PSHELL: System.Management.Automation.PSInvalidOperationException : The pipeline was not run because a pipeline is already running. Pipelines cannot be run concurrently.

v:\> echo %@pshell['foo']
foo
In both cases, it fails the first time and works thereafter.
 
May 20, 2008
9,425
63
Syracuse, NY, USA
The error described in my previous post happens if (any) plugins are automatically loaded. Manually unloading all plugins before using PSHELL/@PSHELL doesn't get rid of the error.

Starting with /ip gets rid of the error. Manually loading any/all plugins befpre using PSHELL/@PSHELL does not bring the error back.

If my tests are correct, the error is related to the automatic loading of plugins.
 
May 20, 2008
9,425
63
Syracuse, NY, USA
Regardless pf plugins (except the one needed for AFFINITY) ...

Code:
set a=%@eval[2 ** %@mrand[4]] & rem 1,2,4,8
affinity %_pid %a
... if I do the above in TCSTART.BTM, I have the problem with PSHELL/@PSHELL.

In fact, if I don't do that in TCSTART, and instead do it with TASKMGR (right-click TCC ... set affinity) I will have the problem with PSHELL/@PSHELL.

I wish I understood it. It's nothing for Rex to be concerned with. But I am curious (Rex?) ... does invoking the PowerShell interface have anything to do with processor affinity?