WSManRunShellCommandEx function (wsman.h)
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 WSManRunShellCommandEx(
[in, out] WSMAN_SHELL_HANDLE shell,
DWORD flags,
[in] PCWSTR commandId,
[in] PCWSTR commandLine,
[in, optional] WSMAN_COMMAND_ARG_SET *args,
[in, optional] WSMAN_OPTION_SET *options,
[in] WSMAN_SHELL_ASYNC *async,
[out] WSMAN_COMMAND_HANDLE *command
);
Parameters
[in, out] shell
Specifies the shell handle returned by the WSManCreateShell call. This parameter cannot be NULL.
flags
Reserved for future use. Must be 0.
[in] commandId
The client specified command Id.
[in] commandLine
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.
[in, optional] args
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.
[in, optional] options
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.
[in] async
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.
[out] command
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
None
Requirements
Requirement | Value |
---|---|
Minimum supported client | Windows 8 |
Minimum supported server | Windows Server 2012 |
Target Platform | Windows |
Header | wsman.h |
Library | WsmSvc.lib |
DLL | WsmSvc.dll |