Summary: Look up variable values in the caller’s scope.
I’m writing a Windows PowerShell advanced function in a script module. How can I look up the value of
variables set in my caller’s scope?
Use the $PSCmdlet.GetVariableValue() method:
[CmdletBinding()]
param ( )
$variableValue = $PSCmdlet.GetVariableValue(‘variableName’)