I'm having issues using Start-Process within a Start-Job, specifically when using -NoNewWindow
. For example, this test code:
Start-Job -scriptblock {
Start-Process cmd -NoNewWindow -Wait -ArgumentList '/c', 'echo' | out-null
Start-Process cmd # We'll never get here
}
get-job | wait-job | receive-job
get-job | remove-job
Returns the following error, that apparently google hasnt heard of:
Receive-Job : There is an error processing data from the background process. Error reported: Cannot process an element with node type "Text". Only Element and EndElement node types are supported.
If I remove the -NoNewWindow
everything works just fine. Am I doing something silly, or is there no way to start jobs containing Start-Process -NoNewWindow
? Any good alternatives?