다음을 통해 공유


Cmdlet.WriteWarning(String) Method

Definition

Display warning information.

public:
 void WriteWarning(System::String ^ text);
public:
 void WriteWarning(Platform::String ^ text);
void WriteWarning(std::wstring const & text);
public void WriteWarning (string text);
member this.WriteWarning : string -> unit
Public Sub WriteWarning (text As String)

Parameters

text
String

Warning 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. WriteWarning may only be called during a call to this Cmdlet's implementation of ProcessRecord, BeginProcessing or EndProcessing, and only from that thread.

Remarks

Use WriteWarning to display warnings about the activity of your Cmdlet. By default, warning output will be displayed, although this can be configured with the WarningPreference shell variable or the -Verbose and -Debug command-line options.

Applies to

See also