0
0
PowerShellscripting~10 mins

Verbose and debug output in PowerShell - Interactive Code Practice

Choose your learning style9 modes available
Practice - 5 Tasks
Answer the questions below
1fill in blank
easy

Complete the code to enable verbose output for the command.

PowerShell
Get-Process [1]
Drag options to blanks, or click blank then click option'
A-Debug
B-ErrorAction
C-Verbose
D-WarningAction
Attempts:
3 left
💡 Hint
Common Mistakes
Using -Debug instead of -Verbose, which shows debug messages, not verbose output.
Using -ErrorAction or -WarningAction which control error or warning behavior, not verbose output.
2fill in blank
medium

Complete the code to write a debug message inside a script.

PowerShell
Write-[1] "This is a debug message"
Drag options to blanks, or click blank then click option'
AVerbose
BDebug
COutput
DWarning
Attempts:
3 left
💡 Hint
Common Mistakes
Using Write-Verbose instead of Write-Debug, which shows verbose messages.
Using Write-Warning or Write-Output which do not write debug messages.
3fill in blank
hard

Fix the error in the script to enable debug messages.

PowerShell
$DebugPreference = '[1]'
Write-Debug "Debugging enabled"
Drag options to blanks, or click blank then click option'
AContinue
BOff
CSilentlyContinue
DStop
Attempts:
3 left
💡 Hint
Common Mistakes
Setting $DebugPreference to 'Off' disables debug messages.
Using 'SilentlyContinue' hides debug messages without stopping the script.
4fill in blank
hard

Fill both blanks to write a verbose message and enable verbose output.

PowerShell
$VerbosePreference = '[1]'
Write-[2] "Verbose message here"
Drag options to blanks, or click blank then click option'
AContinue
BStop
CVerbose
DDebug
Attempts:
3 left
💡 Hint
Common Mistakes
Using $VerbosePreference = 'Stop' which blocks verbose messages.
Using Write-Debug instead of Write-Verbose for verbose messages.
5fill in blank
hard

Fill all three blanks to create a script that enables debug, verbose output, and writes both messages.

PowerShell
$DebugPreference = '[1]'
$VerbosePreference = '[2]'
Write-[3] "Debug message"; Write-Verbose "Verbose message"
Drag options to blanks, or click blank then click option'
AContinue
BStop
CDebug
DVerbose
Attempts:
3 left
💡 Hint
Common Mistakes
Setting preferences to 'Stop' which disables messages.
Using Write-Verbose instead of Write-Debug for the debug message.