Terminal Services Administration

Terminal Services Administration

The Terminal Services API enables you to enumerate and manage Terminal Servers, client sessions, and processes.

To retrieve the names of all the Terminal Servers in a domain, call the NetServerEnum function to enumerate servers of the SV_TYPE_TERMINALSERVER type. To open a handle to a specific Terminal Server, pass the server name in a call to the WTSOpenServer function. Call the WTSCloseServer function to close the handle when you are finished with it.

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 Terminal Server.
WTSEnumerateProcesses Returns a list of processes on the specified Terminal Server.
WTSLogoffSession Logs off the specified session.
WTSQuerySessionInformation Returns information about the specified session on the specified Terminal Server.
WTSSendMessage Shows a message box on the client display of a specified session.
WTSShutdownSystem Shuts down and optionally restarts a specified Terminal Server.
WTSTerminateProcess Terminates a specified process on a specified Terminal Server.
WTSVirtualChannelOpen Opens a handle to the server end of a specified virtual channel. For more information about virtual channels, see Using Terminal Services Virtual Channels.
WTSWaitSystemEvent Waits for an event, such as the creation of a client session or a user logging on to the Terminal Server.

Several of these functions allocate buffers to return information to the caller. Call the WTSFreeMemory function to free the buffer when you are finished with it.

个人分类: 技术文章
想对作者说点什么? 我来说一句

Mstsc (Microsoft terminal services client)

2011年11月18日 587KB 下载