PowerTip: Enable Script Tracing in PowerShell Functions
Summary: Enable script tracing into and out of Windows PowerShell functions. How can I trace my script execution into and out of Windows PowerShell functions? Use the Set-PSDebug cmdlet and set a trace level of 2: Set-PSDebug -Trace 2