CmdID

CmdID / PowerShell / Cmdlets / Write

Write-Debug

Writes a debug message to the console. PowerShell reference

From the PowerShell reference 1 parameter

Opens CmdID with your command, read as PowerShell. It is read in your browser and sent nowhere.

What it does

from the PowerShell reference, CC BY 4.0

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."Identify

Change 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.Identify

Use the Debug parameter to override $DebugPreference

function Test-Debug { [CmdletBinding()] param() Write-Debug ('$DebugPreference is ' + $DebugPreference) Write-Host ('$DebugPreference is ' + $DebugPreference) }Identify

Its page in the reference: Write-Debug.

Parameters

1 in the PowerShell reference
-MessageSpecifies the debug message to send to the console.