Quantcast
Channel: Hey, Scripting Guy! Blog
Viewing all articles
Browse latest Browse all 3333

PowerTip: Use PowerShell to Look Up Variable Values

$
0
0

Summary: Look up variable values in the caller’s scope.

Hey, Scripting Guy! Question 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?

Hey, Scripting Guy! Answer Use the $PSCmdlet.GetVariableValue() method:

[CmdletBinding()]

param ( )

$variableValue = $PSCmdlet.GetVariableValue(‘variableName’)


Viewing all articles
Browse latest Browse all 3333

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>