WSManCreateShell function (wsman.h)
Creates a shell object. The returned shell handle identifies an object that defines the context in which commands can be run. The context is defined by the environment variables, the input and output streams, and the working directory. The context can directly affect the behavior of a command. A shell context is created on the remote computer specified by the connection parameter and authenticated by using the credentials parameter.
Syntax
void WSManCreateShell(
[in, out] WSMAN_SESSION_HANDLE session,
DWORD flags,
[in] PCWSTR resourceUri,
[in, optional] WSMAN_SHELL_STARTUP_INFO *startupInfo,
[in, optional] WSMAN_OPTION_SET *options,
[in, optional] WSMAN_DATA *createXml,
[in] WSMAN_SHELL_ASYNC *async,
[out] WSMAN_SHELL_HANDLE *shell
);
Parameters
[in, out] session
Specifies the session handle returned by a WSManCreateSession call. This parameter cannot be NULL.
flags
Reserved for future use. Must be zero.
[in] resourceUri
Defines the shell type to create. The shell type is defined by a unique URI. The actual shell object returned by the call is dependent on the URI specified. This parameter cannot be NULL. To create a Windows cmd.exe shell, use the WSMAN_CMDSHELL_URI resource URI.
[in, optional] startupInfo
A pointer to a WSMAN_SHELL_STARTUP_INFO structure that specifies the input and output streams, working directory, idle time-out, and options for the shell.
If this parameter is NULL, the default values will be used.
[in, optional] options
A pointer to a WSMAN_OPTION_SET structure that specifies a set of options for the shell.
[in, optional] createXml
A pointer to a WSMAN_DATA structure that defines an open context for the shell. The content should be a valid XML string. This parameter can be NULL.
[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 WSManCloseShell method.
[out] shell
Defines a shell handle that uniquely identifies the shell object. The resource handle is used to track the client endpoint for the shell and is used by other WinRM methods to interact with the shell object. The shell object should be deleted by calling the WSManCloseShell method. This parameter cannot be NULL.
Return value
None
Requirements
Requirement | Value |
---|---|
Minimum supported client | Windows 7 |
Minimum supported server | Windows Server 2008 R2 |
Target Platform | Windows |
Header | wsman.h |
Library | WsmSvc.lib |
DLL | WsmSvc.dll |
Redistributable | Windows Management Framework on Windows Server 2008 with SP2 and Windows Vista with SP2 |