returning of an object from jobtracker completedscript block

Ask your PowerShell-related questions, including questions on cmdlet development!
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.
This topic is 8 years and 4 months old and has exceeded the time allowed for comments. Please begin a new topic or use the search feature to find a similar but newer topic.
Locked
jvierra
Posts: 15439
Last visit: Tue Nov 21, 2023 6:37 pm
Answers: 30
Has voted: 4 times
Been upvoted: 33 times

Re: returning of an object from jobtracker completedscript block

Post by jvierra »

Good luck. Glad you got it.
User avatar
dan.potter
Posts: 709
Last visit: Wed Nov 14, 2018 11:39 am

Re: returning of an object from jobtracker completedscript block

Post by dan.potter »

sure it does.
  1. $buttonStartJob_Click={
  2.    
  3.     $JobScript={
  4.          [PSCustomObject]@{mycomputer = $env:computername}
  5.     }
  6.    
  7.     $UpdateScript={
  8.         Param($Job)
  9.        
  10.     }
  11.    
  12.     $CompletedScript={
  13.         Param($Job)
  14.         $script:results = Receive-Job -Job $Job
  15.        
  16.     }
  17.    
  18.     $jobSplat=@{
  19.         Name='myjob'
  20.         JobScript=$JobScript
  21.         UpdateScript=$UpdateScript
  22.         CompletedScript=$COmpletedScript
  23.     }
  24.  
  25.     Add-JobTracker @jobSplat
  26.  
  27. }
This topic is 8 years and 4 months old and has exceeded the time allowed for comments. Please begin a new topic or use the search feature to find a similar but newer topic.
Locked