PowerTip: Avoid Prompt When Using –Debug

Doctor Scripto

Dr Scripto

Summary: Boe Prox shows how to avoid being prompted when using –Debug.

Hey, Scripting Guy! Question I love using –Debug in functions to figure out what is going on, but how can I avoid being prompted
           each time I run into Write-Debug in my code?

Hey, Scripting Guy! Answer After you declare your parameters, check for –Debug, and set the $DebugPreference 
           value to ‘Continue’ instead of ‘Inquire’:

If ($PSBoundParameters[‘Debug’]) {



Doctor Scripto
Dr Scripto

Scripter, PowerShell, vbScript, BAT, CMD

Follow Dr Scripto   


    Leave a comment