WinBatch Tech Support Home

Database Search

If you can't find the information using the categories below, post a question over in our WinBatch Tech Support Forum.

TechHome

Terminal Server

Can't find the information you are looking for here? Then leave a message over on our WinBatch Tech Support Forum.

!!NEWSFLASH - News about the WIL Terminal Services Extender

Keywords: 	  WIL Terminal Services Extender 

Version 38000    Sep 27, 2002
Initial Release.
   
   This is the first production release of the 
   Windows Terminal Services Extender.

   This extender allows a WinBatch script to directly enumerate,
   interrogate and manipulate terminal services sessions on a
   WinNT/2K/XP system that has terminal services enabled on it.
   This functionality also works on a system that is running the
   Citrix MetaFrame & MetaFrame/XP software, although the extender
   does not have the ability to take advantage of any 
   Citrix-specific functionality enhancements.  Additional
   Citrix-related enhancements might be made to this extender in
   future releases.
   
   This extender cannot be used by a script that is not running on
   system with terminal services enabled.  In that situation
   [e.g. running on a regular WinNT system or a Win2K system w/o
   terminal services installed], the extender will load but its
   functionality will be reduced to where all it can do is to
   return the extender version and allow the user to safely query
   the system as to whether or not the extender has detected
   terminal services.  This means that all scripts can load the
   extender [on the NT platform family], but it is necessary to
   call the function wtsIsTSEnabled() in order to determine if it
   is safe to all any other funtions in the extender [except for
   wtsVersion() - this is safe all of the time].
   
   Refer to the help file for this extender, TermServ.hlp,  for
   complete information on how to use this extender.

==================================================================
Version 38001    Oct 1, 2002


   1.  Fixed a bug in wtsIsTSEnabled() that caused it to
   mistakenly report that terminal services were always disabled
   on WinXP Home & Pro.
   
   2.  Fixed a bug in wtsQuerySessionInfo() that caused it to
   return wrong values for the client's IP address.
   
   3.  Added a new function named wtsShutdownSystem() that
   allows a remote terminal server system to be shut down.
   
   4)  Several miscellaneous documentation errors were
   corrected.
   
   5)  Included a sample script named TSExplorer.wbt.  This
   script is the Terminal Server Explorer script, and it
   demonstrates the usage of many of the WTS extender functions
   in a script that also happens to use the dynamic dialog box
   features in WinBatch.

==================================================================
Version 38002    Nov 1, 2002


   1.  Modified wtsQuerySessionInfo() so that any errors returned
   by the WTSQuerySessionInformation() Win32 API will be
   suppressed instead of causing the extender to generate an error
   tp the script that called wtsQuerySessionInfo().  This means
   that a failure to obtain certain information items will result
   in either an empty string or a numeric zero value to be returned.
   
   The reason making for this change is that certain older versions
   of Citrix MetaFrame [not the MetaFrame/XP product] running on
   WinNT v4.0 Terminal Server Edition always cause the Win32 API 
   function WTSQuerySessionInformation() to return an error.
   Rather than have this extender be unusable on those systems,
   it is easier simply to suppress the errors and have the
   extender fill in with empty strings and zeros in the elements
   of the array that gets returned.


==================================================================
v38003 Release Notes, 2003-02-16


1.  Modified wtsVersion() to fix a problem where a GPF would occur if the function was called w/o
    a value for the 'Request' parameter.  Omitting the 'Request' parameter will now result in the
    function working as if a value of zero had been passed in [per the docs].


==================================================================

v38004 Release Notes, 2003-03-31


1.  Modified wtsEnumSessions() to fix a problem where a GPF would occur in a situation that cannot
    be predicted where no error occurs when enumerating sessions on a server, but no sessions are 
    actually enumerated.


==================================================================


v38005 Release Notes, 2004-04-25


1.  The WTS extender has been modified to change how it tests for the presence of 
    terminal services when it is initializing itself.  The original design allowed
    the extender to load w/o generating any errors if it was loaded on a system on
    which Terminal Services were not installed.  The function wtsIsTSEnabled() is
    called in a script to test whether or not the extender was able to successfully
    load WTSAPI32.DLL after having determined that Terminal Services were present.

    It turns out that on WinNT v4.0 & Win2K, it is permissible to copy WTSAPI32.DLL
    to a workstation/professional variant of the O.S. from a system that already
    has terminal services enabled on it.  The reason for wanting to do this is that
    it is desirable to manage remote terminal services systems from a workstation
    that does not have terminal services enabled on it.  Unfortunately, the original
    method of detecting the presence of terminal services on a system would cause
    this extender to not even attempt to load WTSAPI32.DLL when the extender is 
    loaded on a workstation.  On WinXP this problem does not occur because WinXP
    [and newer] has terminal services built-in.  However, this problem would not
    allow the extender to load & function properly on a WinNT v4.0 / Win2K workstation.

    The modification that has been made to the extender now allows for the extender
    to make a last-ditch effort when it does not detect the presence of terminal
    services on the system.  If WTSAPI32.DLL is found, an attempt will still be made
    to load it.  If the load is successful and all of the required API functions can
    be located [e.g. addresses are obtained for them] then the extender will behave 
    as if terminal services were in fact present & enabled.  If the function
    wtsIsTSEnabled() is called, it will return @TRUE.  If WTSAPI32.DLl cannot be
    loaded [when T.S. was not detected], then no error will be raised and the function
    wtsIsTSEnabled() will return @FALSE.

    The following text replaces the 2nd paragraph of text in the main help topic of
    the help file for the WTS extender:

    This extender cannot be used by a script that is not running on system with terminal 
    services enabled.  In that situation [e.g. running on a regular WinNT system or a Win2K 
    system w/o terminal services installed], the extender will load but its functionality 
    will be reduced to where all it can do is to return the extender version and allow the 
    user to safely query the system as to whether or not the extender has detected terminal 
    services.  This means that all scripts can load the extender [on the NT platform family], 
    but it is necessary to call the function wtsIsTSEnabled() in order to determine if it is 
    safe to call any other functions in the extender [except for wtsVersion() - this is safe 
    all of the time].  However, it is permissible to copy the WTSAPI32.DLL file from another
    Win2K server system that has terminal services enabled on it and place the file in the 
    "%windir%\system32" directory on the workstation.  The server system from which the file 
    is copied should match the workstation's version & service pack level to ensure that it is
    compatible with the workstation.  When this has been done, it is possible for the WTS
    extender to load and function normally on a workstation does not otherwise have terminal
    services enabled on it.  The workstation may then be used to perform remote administration
    of other terminal server systems on the network.  This is not an issue on WinXP [and newer]
    as terminal services are built into WinXP [and newer] as a standard feature.  In the case
    of a WinNT v4.0 Workstation system, multiple files need to be copied to "%windir%\system32"
    from a WinNT v4.0 Terminal Server Edition server in order for the WTS* API functions to be
    usable from a regular workstation.  The list of files is WTSAPI32.DLL, UTILDLL.DLL, 
    WINSTA.DLL and REGAPI.DLL.  A final note regarding WinNT v4.0 Workstation, if the specified
    files are copied onto the workstation, the WTS extender will work except for the function
    wtsProcIdToSessId(), which will raise an error if it is called in that configuration.  The
    help text for wtsProcIdToSessId() and wtsIsTSEnabled() has been updated to make note of
    this issue.

2)  The TSExplorer.wbt demonstration script has been updated & tested with current versions
    of the WTS & NT extenders.  Also, it has been discovered that the wntServerList()
    function will not return any server names when it is used to list terminal servers where
    the domain name is an empty string [e.g. use default domain] and the system on which it
    is being executed is not a member of a domain [e.g. is in a work group].  The TSExplorer
    script has been modified to allow for a domain name to be entered in a text field on the
    dialog box to work around this problem.

3)  A new error code has been added, error code 907, which is raised when the function
    wtsProcIdToSessId() is called on a WinNT v4.0 Workstation/Server system that has had
    the WTS*() API function library files copied over to it from a WinNT v4.0 Terminal
    Server Edition system.



==================================================================


v38006 Release Notes, 2004-04-29


1.  The function wtsIsTSEnabled() has been modified.  It now takes an optional
    parameter that allows for a distinction to be made between the presence of
    the Terminal Services API and the presence of the Terminal Services product
    on the local system on which the extender has been loaded.

2.  The TSExplorer script has been modified.  It now allows for an arbitrary
    server name to be manually entered into an editbox on the main dialog box.
    This change was necessary because systems that only have remote desktop or
    remote administration enabled, as opposed to having terminal services installed
    in application mode, do not announce themselves on the network as being terminal
    server systems.  Now, the name of one of those types of systems may be manually
    entered into the editbox and the "refresh sessions" button may be clicked in
    order to get a list of sessions on one of those types of servers.

    If the server name in the edit box is modified at all and any button besides
    refresh servers or refresh sessions is clicked, then the list of servers will
    be refreshed instead of the function being performed that is normally assigned
    to the button that was clicked.  The exceptions, of course, are the close button
    and the about button, which will work normally.  This is done to prevent any
    confusion from happening such as changing the server name w/o refreshing the
    list of sessions when, say, the logoff session button is to be clicked.

    Finally, clicking the refresh servers list will clear out any text in the
    selected server editbox.



==================================================================

v38007 Release Notes, May 18, 2004


1.    The “NUL” device no longer needs to be present on the system for the
      internal *AllocPrintf*() functions to work properly.  Previously, these
      utility functions were dependent upon the “NUL” device being present.  
      However, it has been determined that builds of the WinXPe [Windows XP 
      Embedded] operating system may not have this device present.  The end 
      result was that not enough memory was being allocated to contain delimited
      lists of string values and memory access violation errors were occurring.  
      These utility routines have been re-written using code from the MS Visual 
      C/C++ C Run Time library to allow them to function properly w/o the 
      “NUL” device.

==================================================================

v38008 Release Notes, May 21, 2004




1.    The wtsQuerySessionInfo() function has been enhanced.  There are now 5 new
      items of information that will be returned in the array.  These 5 new items
      of information are the current time [on the Terminal Server system], the
      login time for the session, the last time that input was received in the
      session, the time the session was most recently connected to a TS/Citrix 
      client and the time the session was most recently disconnected from a
      TS/Citrix client.  By using the TimeDiff*() and TimeSubtract()
      functions, the idle time for the session can be derived from the current
      time and last input time values.
      
      The help text for wtsQuerySessionInfo() has been updated.  Specifically, the
      return values and example code have been changed to document these new items
      of information that can now be returned.


2.    The TSExplorer.wbt demo script has been updated. (See help file.)



==================================================================

v44001 Release Notes, Aug 16, 2004




1.    The WTS extender has been updated to use the "44I" interface specifications.
      This was done as part of resolving a serious memory leak problem related to
      returning arrays as the return values of extender functions when the arrays 
      contain string values in one or more of their elements.  The "44I" interface
      specifications implement a completely re-written set of methods to be used by
      extenders when returning arrays to WIL from within an extender function.  
      WinBatch 2004F or newer is required to use this version of the WTS extender. 
      Please update all scripts' calls to AddExtender() to refer to "WWWTS44I.DLL" 
      instead of "WWWTS34I.DLL".

2.    The function wtsQuerySessionInfo() has been modified.  There is a memory
      leak in the underlying Win32 API function WTSQuerySessionInformation() that
      only occurs on WinXP & newer systems when the Application Name and Initial
      Program information items are retrieved.  This extender function has been
      modified to not retrieve these values on WinXP & newer; the value 
      "*UNSUPPORTED*" is returned in the appropriate array elements when this
      function is called on WinXP & newer systems.

3.    The wtsIsTSEnabled() function has been modified to return additional
      information.

4.    A new function has been added.  The function is named wtsIsCitrixEnabled().
      This function works similar to wtsIsTSEnabled(), except that it reports on the
      presence of Citrix-specific functionality rather than general purpose Terminal
      Services functionality.  Future enhancements to the WTS extender that take 
      advantage of Citrix-specific functionality will be dependent upon being able to
      test for the presence of various Citrix API function libraries.

5.    The TSExplorer.wbt sample script has been updated.

6.    The wtsVersion() function has been updated.

7.    Help file topic updates exist for wtsQuerySessionInfo(), wtsIsTSEnabled()
      and wtsVersion().  A new help file topic exists for wtsIsCitrixEnabled().

==================================================================

v44002 Release Notes, Mar 21, 2012

1.     The extender now writes additional error information to the wwwbatch.ini file 
       in the WinBatch appdata folder.

2.     Fixed bug in the 'wtsGetActiveConsoleSessId' function that caused it to always 
       return a session id of 0.

3.     Added native 64-bit version of the extender for use with 64-bit WinBatch and 
       WinBatch+Compiler.  

==================================================================

v44003 Release Notes, Aug 03, 2020

1.     Added optional "virtualization host" parameter to the wtsEnumProcesses 
       function. When set it allows the function to enumerate processes on Remote 
       Desktop Virtualization Hosts.  Requires Windows 7/2008 R2 or newer and is
       ignored on older systems. 

2.     Added optional "virtualization host" parameter to the wtsEnumSessions 
       function. When set it allows the function to enumerate processes on Remote 
       Desktop Virtualization Hosts.  Requires Windows 7/2008 R2 or newer and is
       ignored on older systems. 





Article ID:   W15426
File Created: 2020:08:03:14:12:48
Last Updated: 2020:08:03:14:12:48