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 (object sendToPipeline);
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.

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 (object sendToPipeline, bool enumerateCollection);
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.