3.1.4.11 Command

Web Services Management Protocol Extensions for Windows Vista MUST support the Command operation, using the following Action URIs.

 http://schemas.microsoft.com/wbem/wsman/1/windows/shell/Command http://schemas.microsoft.com/wbem/wsman/1/windows/shell/CommandResponse

The set of resource URIs on which Web Services Management Protocol Extensions for Windows Vista operating system MUST support the Command operation is defined in the following table, and where relevant, the Xml Schema Definition (XSD) type for the data that is passed as part of the request or response is referenced.

Resource URI

Input data type

Output data type

http://schemas.microsoft.com/wbem/wsman/1/windows/shell/cmd

rsp:CommandLine

rsp:CommandResponse

This operation is applicable for the Text-based Command Shell scenario only. The Custom Shell scenario uses Send to execute the command as specified in Section 3.1.4.13. To execute a command within a Shell, the Command message MUST be sent to the EPR of an existing Shell instance.<116>. This EPR was obtained from a wst:ResourceCreated message during Shell instance creation.

The Command message MUST be of the following form.

 <s:Envelope ...>
   <s:Header ...>
     <wsman:ResourceURI>
       http://schemas.microsoft.com/wbem/wsman/1/windows/shell/cmd
     </wsman:ResourceURI>
     <wsman:SelectorSet>
        <wsman:Selector Name="ShellID">
            ...shell GUID...
        </wsman:Selector>
     </wsman:SelectorSet>
     <wsman:OptionSet xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
        <wsman:Option Name="xs:string"/>...value...</wsman:Option>+
     </wsman:OptionSet>   
       ...other WS-Addressing & WS-Management headers...
   </s:Header>
   <s:Body ...>
     <rsp:CommandLine ...>
        ...Value defined by the CommandLine data type...
     </rsp:CommandLine>
   </s:Body>
 </s:Envelope>
  

The following named options MAY be used with the Command message.<117>

Option

Description

WINRS_CONSOLEMODE_STDIN

The client-side mode for standard input is console if TRUE and pipe if FALSE. This does not have an impact on the wire protocol. This option name MUST be used by the client of the Text-based Command Shell when starting the execution of a command using rsp:Command request to indicate that the client side of the standard input is console; the default implies pipe.

WINRS_SKIP_CMD_SHELL

If set to TRUE, this option requests that the server runs the command without using cmd.exe; if set to FALSE, the server is requested to use cmd.exe. By default the value is FALSE. This does not have any impact on the wire protocol.

Upon successful processing of a Command request message, a Shell processor MUST perform the following steps:

  • Increment the server-side counter for MaxConcurrentOperationsPerUser. The request MUST be rejected if the number of concurrent operations for the particular user exceeds the specified limit, and the Shell processor MUST reply with a wsman:QuotaLimit fault.

  • Return a CommandResponse message, which MUST adhere to the following form.

     <s:Envelope ...>
       <s:Header ...>
         <wsman:ResourceURI>
           http://schemas.microsoft.com/wbem/wsman/1/windows/shell/cmd
         </wsman:ResourceURI>
         <wsman:SelectorSet>
            <wsman:Selector Name="ShellID">
             ...shell GUID...
            </wsman:Selector>
         </wsman:SelectorSet>
             ...other WS-Addressing & WS-Management headers...
       </s:Header>
       <s:Body ...>
         <rsp:CommandResponse ...>
             ...Value defined by the CommandResponse data type...(section 2.2.3.4)
         </rsp:CommandResponse>
       </s:Body>
     </s:Envelope>