In general, is there a convenient way to figure out which lines of a PowerShell script/function are returning values (are "uncaptured")? I was hoping there was a way to query the current state of the to-be-returned value while debugging. I can check it after each line to see which lines add to it.
I have some scripts at work and some lines are turning my return value into an Object[]. I usually pipe such lines to Out-Null to fix the situation. I only want one object returned (the one I pick at the end of the function).
Some of the lines are Cmdlet calls, some are calls to other functions, and some are function calls on .NET objects.