Bird
0
0

What output will you see when running this PowerShell script with the -Verbose parameter?

medium📝 Command Output Q4 of 15
PowerShell - Scripting Best Practices
What output will you see when running this PowerShell script with the -Verbose parameter?
Write-Output "Initializing"
Write-Verbose "Loading configuration"
Write-Output "Configuration loaded"
Write-Verbose "Initialization complete"
AOnly "Initializing" and "Configuration loaded" are displayed
BAll messages including verbose ones are displayed
COnly verbose messages are displayed
DNo output is displayed
Step-by-Step Solution
Solution:
  1. Step 1: Understand Write-Output behavior

    Write-Output always displays output regardless of parameters.
  2. Step 2: Understand Write-Verbose behavior

    Write-Verbose messages only display when the script is run with -Verbose.
  3. Step 3: Analyze the script with -Verbose

    Since -Verbose is used, verbose messages should appear along with output.
  4. Step 4: Confirm actual output

    However, Write-Verbose messages are displayed only if the preference variable allows it. By default, with -Verbose, verbose messages are shown.
  5. Final Answer:

    All messages including verbose ones are displayed -> Option B
  6. Quick Check:

    Verbose flag enables verbose messages [OK]
Quick Trick: Verbose messages show only with -Verbose flag [OK]
Common Mistakes:
  • Assuming Write-Verbose messages always show
  • Confusing Write-Output with Write-Verbose
  • Thinking -Verbose disables normal output

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More PowerShell Quizzes