HOW TO: Use Terminal Server APIs via Windows Scripting Host (299947)



The information in this article applies to:

  • Microsoft Windows NT Server 4.0 Terminal Server Edition
  • Microsoft Windows 2000 Server

This article was previously published under Q299947

SUMMARY

There is no interface for Windows Terminal Services APIs via the Windows Scripting Host or Active Server Pages (ASP). However, the existing APIs can be leveraged if they are implemented in a COM object (as documented in the Platform SDK). This article provides source code (Atlwts_source.exe) for a sample ATL COM object (Atlwts_2.dll) that implements the following Windows Terminal Services APIs:

WTSSendMessage
WTSQuerySessionInformation
WTSQueryUserConfig
WTSOpenServer
WTSEnumerateSessions
WTSFreeMemory
WTSCloseServer
WTSLogoffSession

This sample ATL COM object can be used from the Windows Scripting Host or from ASP, and a sample of each is included as well.

MORE INFORMATION

The following file is available for download from the Microsoft Download Center:
Release Date: Jul-18-2001

For additional information about how to download Microsoft Support files, click the following article number to view the article in the Microsoft Knowledge Base:

119591 How to Obtain Microsoft Support Files from Online Services

Microsoft scanned this file for viruses. Microsoft used the most current virus-detection software that was available on the date that the file was posted. The file is stored on security-enhanced servers that help to prevent any unauthorized changes to the file. The Atlwts_source.exe file contains the following files:

WTSHelper.h2 KB
ATLWTS_2.cpp2 KB
ATLWTS_2.def1 KB
ATLWTS_2.dsp14 KB
ATLWTS_2.dsw1 KB
ATLWTS_2.h12 KB
ATLWTS_2.idl2 KB
ATLWTS_2.ncb73 KB
ATLWTS_2.opt59 KB
ATLWTS_2.plg1 KB
ATLWTS_2.rc4 KB
ATLWTS_2.tlb3 KB
ATLWTS_2_i.c2 KB
ATLWTS_2_p.c17 KB
ATLWTS_2ps.def1 KB
ATLWTS_2ps.mk1 KB
Dlldata.c1 KB
Resource.h1 KB
StdAfx.cpp1 KB
StdAfx.h1 KB
Tester_WTSHelper.vbs2 KB
WTSHelper.cpp17 KB
ATLWTS_2.APS4 KB
WTSHelper.rgs1 KB
Tester_WTSHelper.asp1 KB


The sample code for the sample object (Atlwts_2.dll) has been tested on Windows 2000 with Terminal Services installed as well as Windows NT 4.0 Terminal Services with Service Pack 4.0 or later, and Microsoft Transaction Server.

Modification Type:MinorLast Reviewed:8/9/2004
Keywords:kbdownload kbdownload kbfile KB299947