PSCommand Class
Definition
Defines a PowerShell command / script object which can be used with PowerShell object.
public sealed class PSCommand
- Inheritance
-
PSCommand
Constructors
| PSCommand() |
Creates an empty PSCommand; a command or script must be added to this PSCommand before it can be executed. |
Properties
| Commands |
Gets the collection of commands from this PSCommand instance. |
Methods
| AddArgument(Object) |
Adds an argument to the last added command. For example, to construct a command string "get-process | select-object name"
|
| AddCommand(Command) |
Add a Command element to the current command pipeline. |
| AddCommand(String) |
Add a command to construct a command pipeline. For example, to construct a command string "get-process | sort-object",
|
| AddCommand(String, Boolean) |
Add a cmdlet to construct a command pipeline. For example, to construct a command string "get-process | sort-object",
|
| AddParameter(String) |
Adds a switch parameter to the last added command. For example, to construct a command string "get-process | sort-object -descending"
|
| AddParameter(String, Object) |
Add a parameter to the last added command. For example, to construct a command string "get-process | select-object -property name"
|
| AddScript(String) |
Add a piece of script to construct a command pipeline. For example, to construct a command string "get-process | foreach { $_.Name }"
|
| AddScript(String, Boolean) |
Add a piece of script to construct a command pipeline. For example, to construct a command string "get-process | foreach { $_.Name }"
|
| AddStatement() |
Adds an additional statement for execution
|
| Clear() |
Clears the command(s). |
| Clone() |
Creates a shallow copy of the current PSCommand. |