IWTSSBPlugin::WTSSBX_GetMostSuitableServer method (tssbx.h)

[The IWTSSBPlugin interface is not supported after Windows Server 2008 R2. Starting with Windows Server 2012 please use the ITsSbPlugin interface.]

Returns the ID of the server to which Terminal Services Session Broker (TS Session Broker) should direct the incoming connection. The redirection logic of the plug-in determines the preferred server.

Syntax

HRESULT WTSSBX_GetMostSuitableServer(
  WCHAR *UserName,
  WCHAR *DomainName,
  WCHAR *ApplicationType,
  WCHAR *FarmName,
  long  *pMachineId
);

Parameters

UserName

A pointer to a Unicode string that contains the user name of the incoming connection.

DomainName

A pointer to a Unicode string that contains the domain name that is associated with the incoming connection.

ApplicationType

A pointer to a Unicode string that contains the name of the program that Remote Desktop Services runs after it creates the session.

FarmName

A pointer to a Unicode string that contains the name of the farm in TS Session Broker that the user is connecting to.

pMachineId

A pointer to the ID of the server to which TS Session Broker will redirect the incoming connection. This value is initially set to the ID of the server provided by the load balancing logic of TS Session Broker.

Return value

Returns S_OK if successful.

Remarks

Use WTSSBX_GetMostSuitableServer to override the default load balancing logic of TS Session Broker. TS Session Broker calls this method after it runs its own load balancing logic. The pMachineId parameter is initially set to the ID of the server provided by the load balancing logic of TS Session Broker. When you implement this method, your redirection logic can return this pMachineId or another one as appropriate.

Whenever a server joins a farm in TS Session Broker, TS Session Broker calls the WTSSBX_MachineChangeNotification method to notify the plug-in and provide a MachineId to identify the new server. When TS Session Broker calls WTSSBX_GetMostSuitableServer, the plug-in should return one of the IDs that TS Session Broker provided to the plug-in. The plug-in should not return the ID of a server that is not in the farm.

Your implementation of WTSSBX_GetMostSuitableServer must return S_OK immediately if successful.

Requirements

   
Minimum supported client Windows Vista
Minimum supported server Windows Server 2008
Target Platform Windows
Header tssbx.h

See also

ITsSbPlugin

IWTSSBPlugin