WSManSetSessionOption function (wsman.h)

Sets an extended set of options for the session.

Syntax

DWORD WSManSetSessionOption(
  [in] WSMAN_SESSION_HANDLE session,
       WSManSessionOption   option,
  [in] WSMAN_DATA           *data
);

Parameters

[in] session

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

option

Specifies the option to be set. This parameter must be set to one of the values in the WSManSessionOption enumeration.

[in] data

A pointer to a WSMAN_DATA structure that defines the option value.

Return value

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

Remarks

If the WSManSetSessionOption method is called with different values specified for the option parameter, the order of the different options is important. The first time WSManSetSessionOption is called, the transport is set for the session. If a second call requests a different type of transport, the call will fail.

For example, the second method call will fail if the methods are called in the following order:

  • WSManSetSessionOption(WSMAN_OPTION_UNENCRYPTED_MESSAGES)
  • WSManSetSessionOption(WSMAN_OPTION_ALLOW_NEGOTIATE_IMPLICIT_CREDENTIALS)
The first method call sets the transport to HTTP because the option parameter is set to WSMAN_OPTION_UNENCRYPTED_MESSAGES. The second call fails because the option that was passed is applicable for HTTPS and the transport was set to HTTP by the first message.

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, Windows Vista with SP1, and Windows Vista with SP2