PowerShell Great Debate: What's Write-Verbose For?

This was a fascinating thing to see throughout The Scripting Games this year: When exactly should you use Write-Verbose, and why? The same question applies to Write-Debug.

  • "I use Write-Debug to provide developer-level comments in my scripts, since I can turn it on with -Debug to see variable contents."
  • "I use Write-Verbose to provide developer-level comments in my scripts, since I can turn it on with -Debug to see variable contents."

See what I mean? Some folks will suggest that Verbose is for "user-friendly status messages;" others eschew Debug entirely and prefer PSBreakpoints for that functionality.

What guidance would you offer for using Write-Verbose and Write-Debug in a script?

[boilerplate greatdebate]

About the Author

Don Jones

Don Jones is a Windows PowerShell MVP, author of several Windows PowerShell books (and other IT books), Co-founder and President/CEO of PowerShell.org, PowerShell columnist for Microsoft TechNet Magazine, PowerShell educator, and designer/author of several Windows PowerShell courses (including Microsoft's). Power to the shell!


  1. I try to use write-debug statements to help with the implementation (things like variable values, counts, etc.). I use write-verbose to provide information to the end-user, like verbal progress indicators (processing object XXX, Finished writing file, etc.).

  2. Pretty much what Mike said. The audience for Write-Verbose is whoever is running my code. The audience for Write-Debug is me (or anyone else maintaining / debugging the code).

  3. I use:

    Write-Verbose for macro level / informative.
    Write-Debug for micro level / investigative.

    Subject to change, given compelling arguments.

    • I just stole your wording from the Comment-Based Help debate (which was better than what I posted over there). Same answer, slightly different topic. 🙂

  4. Like Dave Wyatt is saying: the audience for Write-Debug is me; the audience for Write-Verbose is for who is running code and wanting to see what's happening.

    I use PowerShell primarily for custom application deployment purposes, so my scripts are very chatty: the flow of the deployment is written to screen and transcript using Write-Host. I added a Write-XXVerbose cmdlet that I use to have the deployment cmdlets spit out more internal information about the flow; it has its own $XXVerbosePreference variable, but adheres to $VerbosePreference and the -Verbose switch.

  5. One way that I use both:

    Write-Verbose is great for telling me what information is being updated when. Example 3000 AD users are being updated with information. I know which user it's on and some repeated information

    I use Write-Debug to tell me every stage it's on, and what information is being handed off. If data is going into a function that then calls other functions. I can determine where it is in the flow of data, and if the information is changing, what its current state is.
    Errors in data do not always lead to the script stopping, so this helps in tracing the information.

    This become very useful when we have many custom scheme fields for other applications to propagate. But the data has lots of scrubbing, reformatting occurring before being inserted. In some situations there is conditional logic in place to determine what data needs to be inserted for a user that is part of say a certain group. That leads to several functions, some calling other functions to process the information.

    For less complex scripts, I follow the previous mentioned formula that Write-Debug is for me, and Write-Verbose is for the user running the script in a console, allowing for write-verbose to be turned off when it’s a scheduled task also.