CmdID / PowerShell / Cmdlets / Write
Write-Debug
Writes a debug message to the console. PowerShell reference
From the PowerShell reference 1 parameter
What it does
Writes a debug message to the console. The Write-Debug cmdlet writes debug messages to the host from a script or command. By default, debug messages are not displayed in the console, but you can display them by using the Debug parameter or the $DebugPreference variable.
Write-Debug [-Message] <String> [<CommonParameters>]
Understand $DebugPreference
Write-Debug "Cannot open file."IdentifyChange the value of $DebugPreference
PS> $DebugPreference
SilentlyContinue
PS> Write-Debug "Cannot open file."
PS>
PS> $DebugPreference = "Continue"
PS> Write-Debug "Cannot open file."
DEBUG: Cannot open file.IdentifyUse the Debug parameter to override $DebugPreference
function Test-Debug {
[CmdletBinding()]
param()
Write-Debug ('$DebugPreference is ' + $DebugPreference)
Write-Host ('$DebugPreference is ' + $DebugPreference)
}IdentifyIts page in the reference: Write-Debug.
Parameters
-MessageSpecifies the debug message to send to the console.