A pointer to a null-terminated string that contains the name of this session. For example, "services", "console", or "RDP-Tcp#0".

pHostName

A pointer to a null-terminated string that contains the name of the computer that the session is running on. If the session is running directly on an RD Session Host server or RD Virtualization Host server, the string contains NULL. If the session is running on a virtual machine, the string contains the name of the virtual machine.

pUserName

A pointer to a null-terminated string that contains the name of the user who is logged on to the session. If no user is logged on to the session, the string contains NULL.

pDomainName

A pointer to a null-terminated string that contains the domain name of the user who is logged on to the session. If no user is logged on to the session, the string contains NULL.

pFarmName

A pointer to a null-terminated string that contains the name of the farm that the virtual machine is joined to. If the session is not running on a virtual machine that is joined to a farm, the string contains NULL.

Remarks

The WTSEnumerateSessionsEx function returns this structure if you call the function and specify a handle to an RD Virtualization Host server that you obtained by calling the WTSOpenServerEx function. In this case, the WTSEnumerateSessionsEx function aggregates all the sessions running on the host itself as well as sessions running on individual virtual machines. The ExecEnvId parameter uniquely identifies each session in the aggregated list. This identifier may be different from the actual session identifier defined in the server or virtual machine that hosts the session, which is specified by the SessionId member.

The session represented by this structure could be a session running directly on the server or a session running within a virtual machine. If the session is running within a virtual machine, the pHostName member contains the name of the virtual machine. The pFarmName member is applicable to sessions that are hosted on virtual machines that are joined to a RD Session Host farm.