System.Management.Automatio ...


Command Class
Defines a command that contains a single cmdlet or script. The Command object is used by the PowerShell and Pipeline objects to define a single command.


Namespace: System.Management.Automation.Runspaces
Assembly: System.Management.Automation (in system.management.automation.dll)
Usage

Dim instance As Command
Syntax

Visual Basic
Public NotInheritable Class Command
C#
public sealed class Command
C++
public ref class Command sealed
J#
public final class Command
JScript
public final class Command
Remarks

The Command object can be used in two ways.

  • The >AddCommand method of the PowerShell object can use the Command object when creating a pipeline.

  • The Invoke or InvokeAsync methods of the Pipeline object can use the Command object when invoking the pipeline.

    In this case, the Command objects are contained in a CommandCollection that is accessed through the Commands property.

Windows PowerShell provides two classes that can define a command. The >PSCommand class allows you to build a pipeline of commands (A|B|C) that contain one or more cmdlets and scripts. In contrast, the Command class allows you to specify only a single cmdlet or script in the command.


Inheritance Hierarchy

System.Object
  System.Management.Automation.Runspaces.Command
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

Development Platforms

Windows Server 2008, Windows Vista, Windows Server 2003, Windows XP, Windows 7, Windows 2008 R2

Target Platforms

Windows Server 2008, Windows Server 2003, Windows Vista, Windows XP, Windows 7, Windows 2008 R2
See Also

Page view tracker