2.2.3.22 CommandMetadata

This data type represents the metadata of a command. CommandMetadata is an object with the following extended properties (see section 2.2.5.2.9):

  • The name of a command

    • Property name: Name.

    • Property type: a non-empty String (see section 2.2.5.1.1).

  • The URI to the documentation of the command. If the higher layer provides a URI for documentation of the command, then the PowerShell Remoting Protocol MUST set HelpUri to the value provided by the higher layer; otherwise the value of HelpUri MUST be set to Null (section 2.2.5.1.20).

    • Property name: HelpUri.

    • Property type: String (see section 2.2.5.1.1).

  • The CommandType of the command

    • Property name: CommandType.

    • Property type: CommandType (see section 2.2.3.19).

  • Types of objects that a command can send as output (see section 2.2.2.19).

    • Property name: OutputType

    • Property type: List (see section 2.2.5.2.6.3) of Strings (see section 2.2.5.1.1) where each string specifies a type name (see section 2.2.5.2.3).

  • Metadata of parameters that the command can accept as Command Parameters (section 2.2.3.13).

    • Property name: Parameters

    • Property type: Dictionary (see section 2.2.6.1.6). Type of dictionary keys: Strings (see section 2.2.5.1.1) that specify parameter name (see property "N" in section 2.2.3.13). Type of dictionary values: ParameterMetadata (see section 2.2.3.23).

The Complex Object described in this section SHOULD have the following type names (section 2.2.5.2.3):

  • Selected.System.Management.Automation.command-type where command type is replaced with a command-type name defined at a higher layer (see section 2.2.3.19).

  • System.Management.Automation.PSCustomObject

  • System.Object

Example:

 <Obj RefId="0">
   <TN RefId="0">
     <T>Selected.System.Management.Automation.CmdletInfo</T>
     <T>System.Management.Automation.PSCustomObject</T>
     <T>System.Object</T>
   </TN>
   <MS>
     <S N="Name">Get-Variable</S>
     <S N="Namespace">Microsoft.PowerShell.Utility</S>
     <S N="HelpUri">http://go.microsoft.com/fwlink/?LinkID=113336</S>
     <Obj N="CommandType" RefId="1">
       <TN RefId="1">
         <T>System.Management.Automation.CommandTypes</T>
         <T>System.Enum</T>
         <T>System.ValueType</T>
         <T>System.Object</T>
       </TN>
       <ToString>Cmdlet</ToString>
       <I32>8</I32>
     </Obj>
     <Nil N="ResolvedCommandName" />
     <Obj N="OutputType" RefId="2">
       <TN RefId="2">
         <T>System.Collections.ObjectModel.ReadOnlyCollection`1[[System.Management.Automation.PSTypeName, System.Management.Automation, Version=1.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35]]</T>
         <T>System.Object</T>
       </TN>
       <LST>
         <S>System.Management.Automation.PSVariable</S>
       </LST>
     </Obj>
     <Obj N="Parameters" RefId="3">
       <TN RefId="3">
         <T>System.Collections.Generic.Dictionary`2[[System.String, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089],[System.Management.Automation.ParameterMetadata, System.Management.Automation, Version=1.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35]]</T>
         <T>System.Object</T>
       </TN>
       <DCT>
         <En>
           <S N="Key">Name</S>
           <Obj N="Value" RefId="4">
             <TN RefId="4">
               <T>System.Management.Automation.ParameterMetadata</T>
               <T>System.Object</T>
             </TN>
             <ToString>System.Management.Automation.ParameterMetadata</ToString>
             <Props>
               <S N="Name">Name</S>
               <S N="ParameterType">System.String[]</S>
               <Obj N="Aliases" RefId="5">
                 <TN RefId="5">
                   <T>System.Collections.ObjectModel.Collection`1[[System.String, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089]]</T>
                   <T>System.Object</T>
                 </TN>
                 <LST />
               </Obj>
               <B N="IsDynamic">false</B>
               <B N="SwitchParameter">false</B>
             </Props>
           </Obj>
         </En>
       </DCT>
     </Obj>
   </MS>
 </Obj>