How do I Start a job of a function i just defined?
function FOO { write-host \"HEY\" } Start-Job -ScriptBlock { FOO } | Receive-Job Receive-Job: The term \'
The function needs to be inside the scriptblock:
Start-Job -ScriptBlock { function FOO { write-host "HEY" } ; FOO } | Wait-Job | Receive-Job