October DealsAmazon USOctober deal check: compare before you payAmazon US: current deals, useful picks and tech finds.Check DealsSlow PC?RecommendedPC slow today? Run a repair scan before it gets worseResolve common Windows issues and optimize system performance.Scan NowOctober DealsAmazon USDeal season is back - check today's better picksAmazon US: current deals, useful picks and tech finds.See Picks×
Skip to content
World desk3 min

Verbose and Debug Output in PowerShell: How to Show and Write Messages

Use -Verbose and -Debug to request messages that a command already emits; use Write-Verbose and Write-Debug in scripts, with preference variables for broader control.

Free tools Windows power users keep installed

One-click scans. No signup required.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Use -Verbose or -Debug on a command to request the corresponding message stream. These switches do not create output by themselves: the cmdlet, provider, script, or advanced function must emit verbose or debug messages. For scripts you control, use Write-Verbose and Write-Debug; use $VerbosePreference and $DebugPreference when you need broader control.

Turn on verbose output for one command

-Verbose is a PowerShell common parameter. It is available on cmdlets and on advanced functions that use CmdletBinding or a Parameter attribute. Add it to the command you are diagnosing:

As an Amazon Associate I earn from qualifying purchases.

Get-ChildItem -Path $env:TEMP -Verbose

The switch displays verbose messages only when that command generates them. Microsoft documents that the default value of $VerbosePreference is SilentlyContinue, so verbose messages are normally hidden: about_CommonParameters.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Write verbose messages in your own script

Write-Verbose sends text to PowerShell’s verbose message stream. It is intended for operational detail such as which file, endpoint, or processing phase a script is handling.

#1 Best Overall
Sale
PowerShell for Sysadmins: Workflow Automation Made Easy
  • Book - powershell for sysadmins: workflow automation made easy
  • Language: english
  • Binding: paperback
Write-Verbose "Searching the Application Event Log."

With the normal preference, that message remains hidden. A caller can request it for the command or script:

.ackup.ps1 -Verbose

Within a command line, you can also force display for an individual call:

Write-Verbose "Searching the Application Event Log." -Verbose

See Microsoft’s Write-Verbose documentation for the stream behavior and command examples.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Show verbose messages through a preference variable

Set $VerbosePreference to Continue when you want verbose messages to display throughout the current scope or session:

$VerbosePreference = 'Continue'
Write-Verbose "Copying file $filename"

A preference variable affects more than a single command, so temporary changes in reusable code should be restored:

$oldVerbosePreference = $VerbosePreference
try {
    $VerbosePreference = 'Continue'
    Invoke-SomeOperation
}
finally {
    $VerbosePreference = $oldVerbosePreference
}

Preference variables are scoped settings; a command-level -Verbose request is narrower and normally the safer first choice for one-off diagnosis. The available preference values and their behavior are documented in about_Preference_Variables.

Show debug output

Debug messages are a separate stream from verbose messages. Use -Debug with a command that emits debug messages:

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
Some-Command -Debug

Replace Some-Command with a real cmdlet or advanced function that implements debug messaging. For a guaranteed message from a script, use:

Write-Debug "Checking input" -Debug

Write-Debug is intended for programmer-oriented troubleshooting, such as inspecting decisions, internal state, or branch selection. Its behavior can include an interactive debugging response depending on $DebugPreference and the host, so do not assume every terminal will prompt identically.

To enable debug messages more broadly, set the preference variable:

$DebugPreference = 'Continue'
Write-Debug "Checking input"

PowerShell’s default debug behavior and preference values are described in about_Preference_Variables; common-parameter behavior is covered by about_CommonParameters.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Verbose versus debug: which should you use?

Aspect Verbose Debug
Purpose Operational progress and processing detail Technical troubleshooting and internal decisions
Script cmdlet Write-Verbose Write-Debug
Command switch -Verbose -Debug
Preference variable $VerbosePreference $DebugPreference
Default display Hidden when the preference is SilentlyContinue Hidden by default
Requirement The command must actually generate messages on that stream

A practical troubleshooting sequence

  1. Try the narrowest switch. Run the specific cmdlet with -Verbose.
  2. Check whether the command supports common parameters. Cmdlets and advanced functions normally do; a basic function may not.
  3. Try debug output separately. Add -Debug if the operation needs implementation-level detail.
  4. Inspect the script’s message calls. Look for Write-Verbose or Write-Debug; a command that contains neither cannot display those streams.
  5. Use a preference variable only for wider diagnosis. Set it in the required scope, then restore the previous value when the diagnostic operation ends.

Why nothing appears

  • The command completed without emitting a message of the requested type.
  • The function is not an advanced function and therefore does not expose common parameters such as -Verbose or -Debug.
  • The relevant preference variable is still suppressing the stream.
  • You enabled verbose output while the information you need is emitted on the debug stream, or vice versa.
  • The message is written to another stream, such as standard output, warning, or error, rather than the verbose or debug stream.
Independent reader supportYour contribution helps us test, update, and keep practical guides available for everyone.Support on Ko-Fi

Design guidance for script authors

Use verbose for users operating the script

Report meaningful milestones, selected resources, and non-error decisions with Write-Verbose. Keep normal output reserved for data the caller expects to consume.

Use debug for implementation details

Put low-level state and branch diagnostics in Write-Debug so routine verbose runs remain readable.

Enable common parameters in advanced functions

Add [CmdletBinding()] to a function that should participate in PowerShell’s common-parameter system, then use Write-Verbose or Write-Debug at the decision points where the messages are useful.

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.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Leave a Reply

Your email address will not be published. Required fields are marked *

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

More from the Wire

  1. World desk4 min
    How to Spot an AI Voice Scam Before Sending MoneyDon’t rely on how a caller sounds. Pause, call back through a known number, and verify the emergency with another trusted person before sending money.
  2. Mountain View desk4 min
    Google’s SynthID Detector: How to Check AI-Generated Images, Video and AudioGoogle’s SynthID Detector looks for an embedded watermark in supported images, video and audio. Here is what its results do—and do not—show.
  3. Redmond desk20 min
    How to create a link to File or Folder in Windows 11Windows 11 gives you several ways to point to a file or folder without moving or duplicating it. You can create a desktop shortcut,…
Recommended PC Tool
Recommended PC Tool
Windows Errors? Fix Them Before They SpreadFree repair scan
Outdated Drivers Are Slowing You DownFree scan - exact matches

Two free Windows tools

One Free Minute Could Fix That PC

Before you go - each of these free tools takes about a minute and tackles what quietly slows a Windows PC down.

Special offer. View Outbyte info, uninstall instructions, EULA, and Privacy Policy.