WSManCloseSession function (wsman.h)

Closes a session object.

Syntax

DWORD WSManCloseSession(
  [in, out, optional] WSMAN_SESSION_HANDLE session,
                      DWORD                flags
);

Parameters

[in, out, optional] session

Specifies the session handle to close. This handle is returned by a WSManCreateSession call. This parameter cannot be NULL.

flags

Reserved for future use. Must be zero.

Return value

This method returns zero on success. Otherwise, this method returns an error code.

Remarks

The WSManCloseSession method frees the memory associated with a session and closes all related operations before returning. This is a synchronous call. All operations are explicitly canceled. It is recommended that all pending operations are either completed or explicitly canceled before calling this function.

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