Write a debug message to the host display.
Syntax
Write-Debug [-message] string [CommonParameters]
Key
-message string
The debug message to send to the console.
{may be piped}
CommonParameters:
-Verbose, -Debug, -ErrorAction, -ErrorVariable, -OutVariable.
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.
Example
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 Commands:
Write-Error - Write an object to the error pipeline.
Write-Host - Display objects through the host user interface
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