You can use a function ExpandStringto expand this variable, for example:
function Test-Param
{
Param(
[Parameter(Mandatory=$true)]$foo
)
$foo = $ExecutionContext.InvokeCommand.ExpandString($foo)
Write-Host $foo
}
You can test it using:
$bar = "hello"
Test-Param
Now just pass $barin the invitation and you will receive hello.
source
share