returning of an object from jobtracker completedscript block

Ask your Windows 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.
User avatar
jvierra
Posts: 12674
Joined: Tue May 22, 2007 9:57 am
Contact:

Re: returning of an object from jobtracker completedscript block

Post by jvierra » Wed Nov 25, 2015 11:13 am

Good luck. Glad you got it.

User avatar
dan.potter
Posts: 709
Joined: Wed Oct 08, 2014 6:02 am

Re: returning of an object from jobtracker completedscript block

Post by dan.potter » Wed Nov 25, 2015 11:14 am

sure it does.
  1. $buttonStartJob_Click={
  2.  
  3.    
  4.  
  5.     $JobScript={
  6.  
  7.          [PSCustomObject]@{mycomputer = $env:computername}
  8.  
  9.     }
  10.  
  11.    
  12.  
  13.     $UpdateScript={
  14.  
  15.         Param($Job)
  16.  
  17.        
  18.  
  19.     }
  20.  
  21.    
  22.  
  23.     $CompletedScript={
  24.  
  25.         Param($Job)
  26.  
  27.         $script:results = Receive-Job -Job $Job
  28.  
  29.        
  30.  
  31.     }
  32.  
  33.    
  34.  
  35.     $jobSplat=@{
  36.  
  37.         Name='myjob'
  38.  
  39.         JobScript=$JobScript
  40.  
  41.         UpdateScript=$UpdateScript
  42.  
  43.         CompletedScript=$COmpletedScript
  44.  
  45.     }
  46.  
  47.  
  48.  
  49.     Add-JobTracker @jobSplat
  50.  
  51.  
  52.  
  53. }

Locked