Yes, I do really know that. That's what I also posted in my previous update.
I mentioned before that I do get values in the function (during debugging) so I figured you would ignore the comments.
So to be clear: I am not using the commented code but still then it does not work.
Run job as a function?
Forum rules
Do not post any licensing information in this forum.
Any code longer than three lines should be added as code using the 'Select Code' dropdown menu or attached as a file.
Do not post any licensing information in this forum.
Any code longer than three lines should be added as code using the 'Select Code' dropdown menu or attached as a file.
Re: Run job as a function?
Without the code you are using it is impossible to understand the question or propose an answer. You have to think this through and post a code example that is actually being used and an explatnation that we can understand.
Re: Run job as a function?
The whole purpose of the JobTrakker is to no wait. THe "JobCompleted" script block is called when the job is complete. This is where the data is available if it has not been removed by the "JobUpdate" script block.
Once you understand how this works the rest will become obvious. Go back and read the blog on the Tracker until you understand what it is trying to show you.
Re: Run job as a function?
Ok, I'll post an example of what I'm trying to do and will look into the jobscript also.
Re: Run job as a function?
Hope that this code (att.) example makes it clear what I'm trying to do.
Hop you could put me on the way.
Hop you could put me on the way.
- Attachments
-
- Retrieve-GroupsAsaJob.psf
- (57.47 KiB) Downloaded 106 times
Re: Run job as a function?
You didn't follow my instructions. You cannot return a value from that function. It exits before the job even executes.
Use this in the JobCompleted script block.
$textboxresults.Text = = Receive-Job -Job $Job
Use this in the JobCompleted script block.
$textboxresults.Text = = Receive-Job -Job $Job
Re: Run job as a function?
Ok, I see. Started all over. However, the $job is empty. Form in att..
Should I then make the $job global via $global:job?
Should I then make the $job global via $global:job?
- Attachments
-
- Retrieve-GroupsAsaJob-V2.psf
- (29.12 KiB) Downloaded 118 times
Re: Run job as a function?
How to use jobs in a form with example code: http://tech-comments.blogspot.com/2017/ ... -form.html
Re: Run job as a function?
Ok, I started again from scratch with this form.
This new form receive-job -id 1 is giving my output now, but can't capture it in a variable.
Even with $test = receive-job -id 1 -keep, the $test is empty during debug.
This new form receive-job -id 1 is giving my output now, but can't capture it in a variable.
Even with $test = receive-job -id 1 -keep, the $test is empty during debug.