Disconnects the network connection of an active shell and its associated commands.
void WINAPI WSManDisconnectShell( _Inout_ WSMAN_SHELL_HANDLE shell, DWORD flags, _In_ WSMAN_SHELL_DISCONNECT_INFO *disconnectInfo, _In_ WSMAN_SHELL_ASYNC *async );
- shell [in, out]
Specifies the handle returned by a call to the WSManCreateShell function. This parameter cannot be NULL.
Can be a WSMAN_FLAG_SERVER_BUFFERING_MODE_DROP flag or a WSMAN_FLAG_SERVER_BUFFERING_MODE_BLOCK flag.
- disconnectInfo [in]
A pointer to a WSMAN_SHELL_DISCONNECT_INFO structure that specifies an idle time-out that the server session may enforce. If this parameter is NULL, the server session idle time-out will not be changed.
- async [in]
Defines an asynchronous structure to contain an optional user context and a mandatory callback function. For more information, see WSMAN_SHELL_ASYNC. This parameter cannot be NULL.
This function does not return a value.
This function suspends network connection to an actively connected server session. Any operations performed on the shell instance, like WSManRunShellCommand, WSManSendShellInput, or WSManSignalShell, are bound to complete before disconnection. This ensures that any data sent through WSManSendShellInput is received by the server session before the shell disconnects. The client can optionally modify the server buffering mode by using flags. The following behavior is observed:
WSMAN_FLAG_SERVER_BUFFERING_MODE_DROP–When buffers are full, the server drops earlier data in response stream buffers to ensure the corresponding command operation continues to run.
WSMAN_FLAG_SERVER_BUFFERING_MODE_BLOCK–When response stream buffers are full, the server blocks command execution. If no flag is specified, the server continues to use either the configured mode or the mode specified when the shell was created. In case of a network failure, if the client is unable to contact the session to disconnect the shell, the following error is returned:
The client session still goes into a disconnected state, but it is not guaranteed that any prior operations have completed before the session is disconnected.
Minimum supported client
|Windows 8 [desktop apps only]|
Minimum supported server
|Windows Server 2012 [desktop apps only]|
Build date: 10/15/2013