Cmdlet.WriteObject Method

Definition

Overloads

WriteObject(Object)

Writes the object to the output pipe.

WriteObject(Object, Boolean)

Writes one or more objects to the output pipe. If the object is a collection and the enumerateCollection flag is true, the objects in the collection will be written individually.

WriteObject(Object)

Writes the object to the output pipe.

public:
 void WriteObject(System::Object ^ sendToPipeline);
public:
 void WriteObject(Platform::Object ^ sendToPipeline);
void WriteObject(winrt::Windows::Foundation::IInspectable const & sendToPipeline);
public void WriteObject (object sendToPipeline);
member this.WriteObject : obj -> unit
Public Sub WriteObject (sendToPipeline As Object)

Parameters

sendToPipeline
Object

The object that needs to be written. This will be written as a single object, even if it is an enumeration.

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

See also

Applies to

WriteObject(Object, Boolean)

Writes one or more objects to the output pipe. If the object is a collection and the enumerateCollection flag is true, the objects in the collection will be written individually.

public:
 void WriteObject(System::Object ^ sendToPipeline, bool enumerateCollection);
public:
 void WriteObject(Platform::Object ^ sendToPipeline, bool enumerateCollection);
void WriteObject(winrt::Windows::Foundation::IInspectable const & sendToPipeline, bool enumerateCollection);
public void WriteObject (object sendToPipeline, bool enumerateCollection);
member this.WriteObject : obj * bool -> unit
Public Sub WriteObject (sendToPipeline As Object, enumerateCollection As Boolean)

Parameters

sendToPipeline
Object

The object that needs to be written to the pipeline.

enumerateCollection
Boolean

true if the collection should be enumerated

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

See also

Applies to