I need to make PowerShell on Windows Server 2019 to read from a (not named) pipe and launch the commands it reads, so I'll be able to launch multiple commands on the same shell, even without knowing them ahead.
Normal pipe makes it exit (probably on EOF, didn't see an error), I tried a way I thought would work, but it takes 100% CPU which is way too much:
-command 'while ($true) {$command = read-host;
if ($command) {invoke-expression -Command $command}}'
How could I do this? is this even possible?