PSScriptMethod Constructor

Initializes a new instance of the PSScriptMethod class that contains the name of the method and the script that is run when the method is called.

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

Dim name As String
Dim script As ScriptBlock

Dim instance As New PSScriptMethod(name, script)

public PSScriptMethod (
	string name,
	ScriptBlock script
public PSScriptMethod (
	String name, 
	ScriptBlock script
public function PSScriptMethod (
	name : String, 
	script : ScriptBlock



The name of the method.


The script to be run when the method is called.

Exception typeCondition

name is null.

For more information about script methods and other method types that can be used to extend objects, see ETS Methods.

Although it is possible to derive from this class, there is no established scenario for doing this and any attempt to do so may result in unexpected behavior.


Target Platforms

Windows Developer Preview, Windows Server Developer Preview

Send comments about this topic to Microsoft.
© 2014 Microsoft