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)
Dim instance As Command
Public NotInheritable Class Command
public sealed class Command
public ref class Command sealed
public final class Command
public final class Command
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.
System.Object
System.Management.Automation.Runspaces.Command
Any public static (Shared in Visual Basic) members of this type are thread safe. Any instance members are not guaranteed to be thread safe.
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