Quantcast
Channel: PowerShell.com – PowerShell Scripts, Tips, Forums, and Resources: Active Threads
Viewing all articles
Browse latest Browse all 8411

function as InitializationScript

$
0
0

During a job, I would like to make a call to a certain function.
As that function isn't in the same scope as the running code, this will fail.

Therefore, I use the common refered syntax:

$scriptblock = {
  function myfunction($param1,$param2){
    blabla...
  }
}

that way I can use the variable $scriptblock as the InitializationScript

However, for the actual job, i can use following syntax:

start-job ${function:what_my_job_should_do}

Why doesn't the ${function:...} syntax work for my initialisation script?
What does that syntax actually do?

 

 


Viewing all articles
Browse latest Browse all 8411

Trending Articles