Take the 2-minute tour ×

Not sure, how to accomplish this.

$a is a variable. Tf() is a test function. a gets values assigned in runtime within another function. Whenever value of $a change, I want to call tf($a) where dollar-a is the parameter for tf().

Posted from mobile app. $ symbol may look weird as in the preview. Sorry about that.

share|improve this question

1 Answer 1

Not sure if that's the best approach, but you can use break points to do that:

Set-PSBreakpoint -Variable a -Action { Write-Host $a } -Mode Write
$a = 'test'

I'm not sure if that will work smoothly without knowing what 'tf' function does. Mind that if you want to modify variables in 'parent' scope, you will need to be explicit about it (-Action script block is running own scope).

share|improve this answer
It's for logging to a text file which uses $a as a parameter - log string. Thanks. Will check and post next update. –  user3850374 Jul 18 at 9:34

Your Answer


