By that point, $PScmd already contains the result of the command. You are assigning all the lines to $PSarray[0].@PSarray = $PScmd ;
There are two ways to fix your code, that I can see:
In reply to Re: manipulation of ps command output
by matija
in thread manipulation of ps command output
by wube
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |