Question: I'm trying to Invoke a Powershell function "dynamically" using a string. Example

```
$functionToInvoke = "MyFunctionName";

Invoke-Function $functionToInvoke $arg1 $arg2  #  <- what I would like to do

```

Is there any way to achieve this with PowerShell 2.0 ?

Answer: 
You can do this:

```
 &"MyFunctionName" $arg1 $arg2

```
If you're wanting to variableize the whlole thing:

```
function myfunctionname {write-host "$($args[0]) $($args[1])"}
$arg1 = "scripts"
$arg2 = "test"

$functionToInvoke = "MyFunctionName";

invoke-expression  "$functionToInvoke $arg1 $arg2"

scripts test

```