Practice - 5 Tasks
Answer the questions below
1fill in blank
easyComplete the code to enable verbose output for the command.
PowerShell
Get-Process [1] Drag options to blanks, or click blank then click option'
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.
✗ Incorrect
The -Verbose parameter enables detailed output about the command's operation.
2fill in blank
mediumComplete 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'
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.
✗ Incorrect
Write-Debug writes a debug message that appears when debugging is enabled.
3fill in blank
hardFix 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'
Attempts:
3 left
💡 Hint
Common Mistakes
Setting $DebugPreference to 'Off' disables debug messages.
Using 'SilentlyContinue' hides debug messages without stopping the script.
✗ Incorrect
Setting $DebugPreference to 'Continue' enables debug messages to be shown.
4fill in blank
hardFill 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'
Attempts:
3 left
💡 Hint
Common Mistakes
Using $VerbosePreference = 'Stop' which blocks verbose messages.
Using Write-Debug instead of Write-Verbose for verbose messages.
✗ Incorrect
Setting $VerbosePreference to 'Continue' enables verbose messages, and Write-Verbose writes the message.
5fill in blank
hardFill 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'
Attempts:
3 left
💡 Hint
Common Mistakes
Setting preferences to 'Stop' which disables messages.
Using Write-Verbose instead of Write-Debug for the debug message.
✗ Incorrect
Both $DebugPreference and $VerbosePreference must be set to 'Continue' to show messages. Write-Debug writes the debug message.