Share via


CommandMetadata Constructors

Definition

Overloads

CommandMetadata(CommandInfo)

Construct a CommandMetadata object for the given commandInfo.

CommandMetadata(CommandMetadata)

A copy constructor that creates a deep copy of the other CommandMetadata object. Instances of Attribute and Type classes are copied by reference.

CommandMetadata(String)

Construct a CommandMetadata object for a script file.

CommandMetadata(Type)

Constructs a CommandMetadata object for the given CLS complaint type commandType.

CommandMetadata(CommandInfo, Boolean)

Construct a CommandMetadata object for the given commandInfo.

CommandMetadata(CommandInfo)

Construct a CommandMetadata object for the given commandInfo.

public:
 CommandMetadata(System::Management::Automation::CommandInfo ^ commandInfo);
public CommandMetadata (System.Management.Automation.CommandInfo commandInfo);
new System.Management.Automation.CommandMetadata : System.Management.Automation.CommandInfo -> System.Management.Automation.CommandMetadata
Public Sub New (commandInfo As CommandInfo)

Parameters

commandInfo
CommandInfo

The commandInfo object to construct CommandMetadata for

Exceptions

commandInfo is null.

If the commandInfo is an alias to an unknown command, or if the commandInfo is an unsupported command type.

Applies to

CommandMetadata(CommandMetadata)

A copy constructor that creates a deep copy of the other CommandMetadata object. Instances of Attribute and Type classes are copied by reference.

public:
 CommandMetadata(System::Management::Automation::CommandMetadata ^ other);
public CommandMetadata (System.Management.Automation.CommandMetadata other);
new System.Management.Automation.CommandMetadata : System.Management.Automation.CommandMetadata -> System.Management.Automation.CommandMetadata
Public Sub New (other As CommandMetadata)

Parameters

other
CommandMetadata

Object to copy.

Applies to

CommandMetadata(String)

Construct a CommandMetadata object for a script file.

public:
 CommandMetadata(System::String ^ path);
public:
 CommandMetadata(Platform::String ^ path);
 CommandMetadata(std::wstring const & path);
public CommandMetadata (string path);
new System.Management.Automation.CommandMetadata : string -> System.Management.Automation.CommandMetadata
Public Sub New (path As String)

Parameters

path
String

The path to the script file.

Applies to

CommandMetadata(Type)

Constructs a CommandMetadata object for the given CLS complaint type commandType.

public:
 CommandMetadata(Type ^ commandType);
public:
 CommandMetadata(Platform::Type ^ commandType);
public CommandMetadata (Type commandType);
new System.Management.Automation.CommandMetadata : Type -> System.Management.Automation.CommandMetadata
Public Sub New (commandType As Type)

Parameters

commandType
Type

CLS complaint type to inspect for Cmdlet metadata.

Exceptions

commandType is null.

If a parameter defines the same parameter-set name multiple times. If the attributes could not be read from a property or field.

Applies to

CommandMetadata(CommandInfo, Boolean)

Construct a CommandMetadata object for the given commandInfo.

public:
 CommandMetadata(System::Management::Automation::CommandInfo ^ commandInfo, bool shouldGenerateCommonParameters);
public CommandMetadata (System.Management.Automation.CommandInfo commandInfo, bool shouldGenerateCommonParameters);
new System.Management.Automation.CommandMetadata : System.Management.Automation.CommandInfo * bool -> System.Management.Automation.CommandMetadata
Public Sub New (commandInfo As CommandInfo, shouldGenerateCommonParameters As Boolean)

Parameters

commandInfo
CommandInfo

The commandInfo object to construct CommandMetadata for

shouldGenerateCommonParameters
Boolean

Should common parameters be included in the metadata?

Exceptions

commandInfo is null.

If the commandInfo is an alias to an unknown command, or if the commandInfo is an unsupported command type.

Applies to