Hello there,
I've found many thread and forum that were subject to this bug (?), but I didn't find a solution that suits my environnement...
I'm working on a Linux CentOS 7 with a PowerShell 6.1.1 package on it. I'm trying to make a loading print that show PowerCli commands is still running and is not crashed 'cause sometimes it's... Very... Very long...
The issue is when I run the loading script the jobs never ends, the only one way to make them finish properly is to redirect output, if there are output directed to the console it hangs.
However I want to keep the object that are returned from my jobs commands, I tried to Export-Clixml those outputs but the issue happens in this situation and I didn't find a way to export my objects in a xml file and avoid the issue by redirecting the output, if I do both export and redirect the xml file is empty.
I've tried with simple commands passed to the -ScriptBlockString parameter, like Get-VM.
This script is adapted from this one: http://www.vxav.fr/2017-08-08-easily-run-powercli-commands-as-jobs/
Thanks !