Information
The topic you requested is included in another documentation set. For convenience, it's displayed below. Choose Switch to see the topic in its original location.

PSCommand.AddParameter Method (String, Object)

 

Updated: April 27, 2016

Applies To: Windows PowerShell

Adds a parameter name and value to the end of the pipeline. This method is introduced in Windows PowerShell 2.0.

Namespace:   System.Management.Automation
Assembly:  System.Management.Automation (in System.Management.Automation.dll)

public PSCommand AddParameter(
	string parameterName,
	object value
)

Parameters

parameterName
Type: System.String

The name of the parameter to add to the end of the pipeline.

value
Type: System.Object

The value of the parameter to add to the end of the pipeline.

Return Value

Type: System.Management.Automation.PSCommand

A PSCommand object with the specified name and value added to the end of the pipeline.

This method must be called after the cmdlet is added, but before another cmdlet is added. Parameters and other commands are only added to the end of the pipeline. You cannot specify which command a parameter belongs to.

To add values for positional parameters where no name is required, use the AddArgument method.

This example adds the name of the Get-Process cmdlet, a parameter, and a parameter argument to the pipeline.

// Using the PSCommand object, add the cmdlet 
// to the command pipeline.
PSCommand cmd = new PSCommand();
          cmd.AddCommand("Get-Process");

Return to top

Community Additions

Show: