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.

PowerShell.Create Method ()


Updated: April 27, 2016

Applies To: Windows PowerShell

Initializes a new instance of the PowerShell class with an empty pipeline. You must call this method to create a PowerShell object. This method is introduced in Windows PowerShell 2.0.

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

public static PowerShell Create()

Return Value

Type: System.Management.Automation.PowerShell

A PowerShell object with an empty pipeline.

To add elements to the pipeline, call the AddCommand and AddScript methods, or set the Commands property by using a PSCommand object with predefined commands.

The following example shows how to create a PowerShell object and add the Get-Process cmdlet to the pipeline.

// Using the PSCommand object, add the cmdlet 
// to the command pipeline.
PSCommand cmd = new PSCommand();

Return to top

Community Additions