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.
jvierra
Posts: 14344
Meble kuchenne na zamówienie - na wymiar - Wrocław
Joined: Tue May 22, 2007 9:57 am
Contact:

Re: returning of an object from jobtracker completedscript block

Post by jvierra »

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 »

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