Use -Verbose or -Debug on a command to request the corresponding messages for that command. They appear only if the command actually generates them. For scripts you own, add Write-Verbose or Write-Debug where you need diagnostic detail.
How to show verbose output for a command
Add the common parameter -Verbose to a cmdlet or advanced function that supports it and emits verbose messages:
Get-ChildItem -Path $env:TEMP -Verbose
Common parameters are available to cmdlets and to advanced functions declared with CmdletBinding or the Parameter attribute. -Verbose requests verbose messages for that command; it does not create messages that the command has not written. Microsoft documents the common parameters and verbose behavior in about_CommonParameters.
How to write verbose messages in a script
Use Write-Verbose to send operational detail to PowerShell’s verbose message stream. For example:
Free tools Windows power users keep installed
One-click scans. No signup required.
#1 Best Overall
Write-Verbose "Searching the Application Event Log."
Verbose messages are hidden by default because $VerbosePreference defaults to SilentlyContinue. A caller can display a script’s verbose messages by invoking it with -Verbose. Alternatively, set the preference to Continue in the current scope or session:
$VerbosePreference = 'Continue'
Write-Verbose "Copying file $filename"
A preference variable affects messages more broadly within its scope than a one-command switch. If you change it temporarily in reusable code, preserve and restore its prior value to avoid changing behavior for later commands. See Microsoft’s Write-Verbose documentation and about_Preference_Variables.
Rank #2
- Book - powershell for sysadmins: workflow automation made easy
- Language: english
- Binding: paperback
How to request debug output
Use -Debug with a command that emits debug messages. For a script you own, add a message at a useful troubleshooting point:
Write-Debug "Checking input" -Debug
Write-Debug writes to the debug message stream; $DebugPreference controls PowerShell’s response to those messages. Depending on that preference, debug behavior may involve more than simply displaying text, so do not assume every host or preference setting behaves identically. The -Debug parameter, like -Verbose, only affects messages the command generates. Microsoft’s preference-variable documentation describes the debug and verbose settings: about_Preference_Variables.
Verbose vs. debug: which should you use?
| Output type | Best suited to | How messages are produced | How to request them |
|---|---|---|---|
| Verbose | Operational detail about what a command or script is doing | Write-Verbose or verbose messages emitted by a command |
-Verbose or $VerbosePreference |
| Debug | More technical troubleshooting detail | Write-Debug or debug messages emitted by a command |
-Debug or $DebugPreference |
For a one-off diagnosis, first try the relevant switch on the specific command. If you need information the command does not emit, add appropriate message calls to the script or function you control.
Quick Recap
Best Value
Rank #4
Product prices and availability are accurate as of the date/time indicated and are subject to change. Any price and availability information displayed on Amazon at the time of purchase will apply.

