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/
I can't use anything else than CentOS, it's a gateway builded to have specific access to our vCenter.
There is some link I've found about this bug:
This one were resolved by the post 5 and 7, the 5th is useable for me because of my environnement (CentOS), the 7th works and is similar to the next link: redirect output to a variable/file/nothing
So the workaround is to use redirection to avoid jobs to hang. It works for me, but I want to use my object afterwards, so I tried to use Export-Clixml but either the jobs keeps hanging or the xml file is empty...
It doesn't work even with the set command at the start of the job script block.
Can't paste the Get-PowerCLIConfiguration command but the DisplayDeprecationWarnings are on false for all users.