Skip to main content
Cmdlet.WriteDebug Method
[This topic is pre-release documentation and is subject to change in future releases. Blank topics are included as placeholders.]

Writes a debug message to the host.


Namespace: System.Management.Automation
Assembly: System.Management.Automation (in System.Management.Automation.dll)
Usage
Dim instance As Cmdlet
Dim text As String

instance.WriteDebug(text)
Syntax
Public Sub WriteDebug ( _
	text As String _
)
public void WriteDebug (
	string text
)
public:
void WriteDebug (
	String^ text
)
public void WriteDebug (
	String text
)
public function WriteDebug (
	text : String
)

Parameters

text

The debug message to be written to the host.

Exceptions
Exception typeCondition
PipelineStoppedException

The pipeline is stopped. The pipeline was terminated either before the call was made or while the call was in progress. By default, the cmdlet should allow the caller of the processing record method to catch this exception.

InvalidOperationException

The call cannot be completed at this time or cannot be completed from this thread. For more information, see the following Remarks section.

Remarks

This method provides a way for cmdlet developers to write debug information while troubleshooting their cmdlets.

This method can be called only from within the cmdlet implementation of the BeginProcessing, ProcessRecord, and EndProcessing methods and only from that thread. If this call is made from outside these implementations or from another thread, an InvalidOperationException exception is thrown.

By default, progress information is displayed, However, this behavior can be changed by configuring the DebugPreference shell variable.

For more information about cmdlets, see Windows PowerShell Cmdlets.


Thread Safety
Any public static (Shared in Visual Basic) members of this type are thread safe. Any instance members are not guaranteed to be thread safe.
Platforms

 

Target Platforms

Windows Developer Preview, Windows Server Developer Preview

Send comments about this topic to Microsoft.