Set-PSBreakpoint -Variable idx -Mode Write -Action { Write-Host -ForegroundColor Red "MyAction: $($idx)" } Function Test ($p) { 0..$p | % { $idx = $_ $idx } } Test 3
Вы можете использовать $ MyInvocation, например:
Set-PSBreakpoint -Variable idx -Mode Write -Action { Write-Host -ForegroundColor Red "$($MyInvocation.MyCommand.Name): $($idx)" }