IWSManConnectionOptionsEx2::SetProxy method (wsmandisp.h)

Sets the proxy information for the session.

Syntax

HRESULT SetProxy(
  [in] long accessType,
  [in] long authenticationMechanism,
  [in] BSTR userName,
  [in] BSTR password
);

Parameters

[in] accessType

Specifies the proxy access type. This parameter must be set to one of the values in the WSManProxyAccessTypeFlags enumeration. The default value is WSManProxyWinHttpConfig.

[in] authenticationMechanism

Specifies the authentication mechanism to use for the proxy. This parameter is optional and the default value is 0. If this parameter is set to 0, the WinRM client chooses either Kerberos or Negotiate. Otherwise, this parameter must be set to one of the values in the WSManProxyAuthenticationFlags enumeration. The default value from the enumeration is WSManFlagProxyAuthenticationUseNegotiate.

[in] userName

Specifies the user name for proxy authentication. This parameter is optional. If a value is not specified for this parameter, the default credentials are used.

[in] password

Specifies the password for proxy authentication. This parameter is optional. If a value is not specified for this parameter, the default credentials are used.

Return value

If this method succeeds, it returns S_OK. Otherwise, it returns an HRESULT error code.

Remarks

The default credentials are the credentials under which the current thread is operating.

Requirements

Requirement Value
Minimum supported client Windows 7
Minimum supported server Windows Server 2008 R2
Target Platform Windows
Header wsmandisp.h
Redistributable Windows Management Framework on Windows Server 2008 with SP2 and Windows Vista with SP2

See also

IWSManConnectionOptionsEx2