I can't seem to figure out why the input passed to start-job disappears. I have this code in one script:
$data = "some test string data"
Start-Job -FilePath ".\Tasks.ps1" -InputObject $data
And in the tasks.ps1
script I get a null value for the $input
object unless I call it immediately but disappears after doing so:
$input #displays the data
$input #null
I've tried immediately assigning it to another variable ($newvalue = $input
) but the value of that variable shows null too.
What am I missing here? How do I retain the input data?