Bird
0
0

You want to debug a script but only see verbose messages, not debug messages. You run it with -Verbose. How can you see debug messages without changing the script?

hard📝 Application Q9 of 15
PowerShell - Scripting Best Practices
You want to debug a script but only see verbose messages, not debug messages. You run it with -Verbose. How can you see debug messages without changing the script?
ARun the script as administrator
BAdd <code>$DebugPreference = 'Continue'</code> inside the script
CRun the script with <code>-Debug</code> instead of <code>-Verbose</code>
DUse <code>Write-Verbose</code> instead of <code>Write-Debug</code>
Step-by-Step Solution
Solution:
  1. Step 1: Understand difference between -Verbose and -Debug

    -Verbose shows verbose messages; -Debug shows debug messages.
  2. Step 2: Choose correct flag

    To see debug messages without script changes, run with -Debug.
  3. Final Answer:

    Run the script with -Debug instead of -Verbose -> Option C
  4. Quick Check:

    Debug messages need -Debug flag [OK]
Quick Trick: Use -Debug to see debug messages, not -Verbose [OK]
Common Mistakes:
  • Using -Verbose expecting debug messages
  • Changing script unnecessarily
  • Assuming admin rights affect debug output

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More PowerShell Quizzes