Cmdlet.WriteDebug(String) Method

Definition

Display debug information.

C++
public:
 void WriteDebug(System::String ^ text);

Parameters

text
String

Debug output.

Exceptions

The pipeline has already been terminated, or was terminated during the execution of this method. The Cmdlet should generally just allow PipelineStoppedException to percolate up to the caller of ProcessRecord etc.

Not permitted at this time or from this thread. WriteDebug may only be called during a call to this Cmdlet's implementation of ProcessRecord, BeginProcessing or EndProcessing, and only from that thread.

Remarks

Use WriteDebug to display debug information on the inner workings of your Cmdlet. By default, debug output will not be displayed, although this can be configured with the DebugPreference shell variable or the -Debug command-line option.

Applies to

Product Versions
PowerShell SDK 7.2.0, 7.3.0, 7.4.0
Windows PowerShell 5.1.0.0

See also