This topic has not yet been rated - Rate this topic

WSManRunShellCommandEx function

Provides the same functionality as the WSManRunShellCommand function, with the addition of a command ID option. If the server supports the protocol, it will create the command instance using the ID specified by the client. If a command with the specified ID already exists, the server will fail to create the command instance. This new functionality is only available when the client application passes the WSMAN_FLAG_REQUESTED_API_VERSION_1_1 flag as part of the call to the WSManInitialize function.

Syntax


void WINAPI WSManRunShellCommandEx(
  _Inout_   WSMAN_SHELL_HANDLE shell,
  DWORD flags,
  _In_      PCWSTR commandID,
  _In_      PCWSTR commandLine,
  _In_opt_  WSMAN_COMMAND_ARG_SET *args,
  _In_opt_  WSMAN_OPTION_SET *options,
  _In_      WSMAN_SHELL_ASYNC *async,
  _Out_     WSMAN_COMMAND_HANDLE *command
);

Parameters

shell [in, out]

Specifies the shell handle returned by the WSManCreateShell call. This parameter cannot be NULL.

flags

Reserved for future use. Must be 0.

commandID [in]

The client specified command Id.

commandLine [in]

Defines a required null-terminated string that represents the command to be executed. Typically, the command is specified without any arguments, which are specified separately. However, a user can specify the command line and all of the arguments by using this parameter. If arguments are specified for the commandLine parameter, the args parameter should be NULL.

args [in, optional]

A pointer to a WSMAN_COMMAND_ARG_SET structure that defines an array of argument values, which are passed to the command on creation. If no arguments are required, this parameter should be NULL.

options [in, optional]

Defines a set of options for the command. These options are passed to the service to modify or refine the command execution. This parameter can be NULL. For more information about the options, see WSMAN_OPTION_SET.

async [in]

Defines an asynchronous structure. The asynchronous structure contains an optional user context and a mandatory callback function. See the WSMAN_SHELL_ASYNC structure for more information. This parameter cannot be NULL and should be closed by calling the WSManCloseCommand method.

command [out]

Defines the command object associated with a command within a shell. This handle is returned on a successful call and is used to send and receive data and to signal the command. This handle should be closed by calling the WSManCloseCommand method. This parameter cannot be NULL.

Return value

This function does not return a value.

Requirements

Minimum supported client

Windows 8 [desktop apps only]

Minimum supported server

Windows Server 2012 [desktop apps only]

Header

Wsman.h

 

 

Send comments about this topic to Microsoft

Build date: 11/19/2012

Community Additions

ADD
© 2013 Microsoft. All rights reserved.