Bird
0
0

Which of the following is the correct syntax to enable debug messages in a PowerShell script?

easy📝 Syntax Q12 of 15
PowerShell - Scripting Best Practices
Which of the following is the correct syntax to enable debug messages in a PowerShell script?
ARun the script with <code>-Debug</code> parameter
BAdd <code>Write-Debug -Enable</code> inside the script
CUse <code>Set-DebugMode On</code> before running the script
DInclude <code>Enable-Debug</code> command in the script
Step-by-Step Solution
Solution:
  1. Step 1: Identify how to enable debug output

    Debug messages appear when the script is run with the -Debug parameter.
  2. Step 2: Check other options for validity

    There is no Write-Debug -Enable, Set-DebugMode, or Enable-Debug commands in PowerShell.
  3. Final Answer:

    Run the script with -Debug parameter -> Option A
  4. Quick Check:

    Debug enabled by running script with -Debug [OK]
Quick Trick: Use -Debug flag when running script to see debug messages [OK]
Common Mistakes:
  • Trying to enable debug inside script with wrong commands
  • Confusing debug enabling with verbose enabling
  • Assuming debug is always on by default

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More PowerShell Quizzes