Muokkaa

Jaa


Remote Desktop Services Administration

The Remote Desktop Services API enables you to enumerate and manage Remote Desktop Session Host (RD Session Host) servers, client sessions, and processes.

To retrieve the names of all the RD Session Host servers in a domain, call the NetServerEnum function to enumerate servers of the SV_TYPE_TERMINALSERVER type. To open a handle to a specific RD Session Host server, pass the server name in a call to the WTSOpenServer function. When you have finished using the handle, release it by calling the WTSCloseServer function.

You can use the handle returned by WTSOpenServer to perform the following operations on the server.

Function Operation
WTSDisconnectSession Disconnects the client from a specified session. The session remains active and the user can log on again to connect to the same session.
WTSEnumerateSessions Returns a list of sessions on the specified RD Session Host server.
WTSEnumerateProcesses Returns a list of processes on the specified RD Session Host server.
WTSLogoffSession Logs off the specified session.
WTSQuerySessionInformation Returns information about the specified session on the specified RD Session Host server.
WTSSendMessage Shows a message box on the client display of a specified session.
WTSShutdownSystem Shuts down and optionally restarts a specified RD Session Host server.
WTSTerminateProcess Terminates a specified process on a specified RD Session Host server.
WTSVirtualChannelOpen Opens a handle to the server end of a specified virtual channel. For more information about virtual channels, see Using Remote Desktop Services Virtual Channels.
WTSWaitSystemEvent Waits for an event, such as the creation of a client session or a user logging on to the RD Session Host server.

 

Several of these functions allocate buffers to return information to the caller. When you have finished using the buffer, free it by calling the WTSFreeMemory function.