O seguinte comando irá mostrar cada linha do script para Write-Debug -
Set-PSDebug -Trace 1
De man Set-PSDebug
When the Trace parameter is set to 1, each line of script is traced as it is executed. When the parameter is set to 2, variable assignments, function calls, and script calls are also traced. If the Step parameter is specified, you are prompted before each line of the script is executed.