Quantcast
Channel: Hey, Scripting Guy! Blog
Viewing all articles
Browse latest Browse all 3333

PowerTip: Avoid Prompt When Using –Debug

$
0
0

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’]) {

    $DebugPreference='Continue'

}


Viewing all articles
Browse latest Browse all 3333

Trending Articles