Write-Debug

Write a debug message to the console.

Syntax
      Write-Debug [-message] string [CommonParameters]

Key
   -message string
       The debug message to send to the console.
       {may be piped}

By default, debug messages are not displayed in the console, but you can display them by using the Debug parameter or the $DebugPreference variable.

The action of Write-Debug is dependent on the value of $DebugPreference
If $DebugPreference = "Continue" PowerShell will show the debug message.
If $DebugPreference = "SilentlyContinue" PowerShell will not show the message.
If $DebugPreference = "Stop" PowerShell will show the message and then halt.
If $DebugPreference = "Inquire" PowerShell will prompt the user.

Examples

Write a debug message:

PS C:\> $DebugPreference = "Continue"
PS C:\> Write-Debug "Something went wrong."

#I hope that someone gets my, I hope that someone gets my, Message in a bottle# ~ Sting / The Police

Related PowerShell Cmdlets

Write-Error - Write an object to the error pipeline.
Write-Host - Display objects through the host user interface.
Write-Information - Write to the information data stream (6).
Write-Output - Write an object to the pipeline.
Write-Progress - Display a progress bar.
Write-Verbose - Write a string to the host’s verbose display.
Write-Warning - Write a warning message.


 
Copyright © 1999-2024 SS64.com
Some rights reserved