Yesterday we learned how to use the InitializationScript parameter of Start-Job . Today we are going to allow for further modularization of our code and send multiple functions to Start-Job . We could very easily send multiple functions in the same script block, but I need to pick and choose which functions I will be working with for each process so I need to be able to send them separately. Here is our code. $JobFunction1 = { Function Beep { Param ( $Tone ) [ console ]::beep( $Tone , 200 ) } } $JobFunction2 = { Function Beep2 { Param ( $Tone , $Time ) [ console ]::beep( $Tone , $Time ) } } $InitializationScript = $executioncontext .invokecommand.NewScriptBlock( " $JobFunction1 $JobFunction2 " ) $JobSplat = @{ Name = "Test1" InitializationScript = $InitializationS...
Welcome to the blogsite of MCTExpert. I am a Microsoft Certified Trainer. Here you will find the real questions that are asked to me by my students.