PowerShell script, showing commands run

The following command will output each line of script to Write-Debug-

Set-PSDebug -Trace 1

From 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.

Leave a Comment