wtsIsTSEnabled

Determines if the system on which this extender was loaded has terminal services enabled.

Syntax:

wtsIsTSEnabled([Request])

Parameters:

(i) request [optional]: This is a number that identifies what type of terminal services availability information is to be returned. The following values are valid:
0 = Terminal Services API presence [default]
1 = Terminal Server Product presence
2 = Terminal Services Client Virtual Channel presence

Returns:

(i) Returns @TRUE if the requested terminal services component is present/enabled, or @FALSE if the component is missing or not enabled.

 

This function is used to determine if terminal services are enabled on the current system.

In earlier versions of this extender, this function did not take any parameters and only tested to see if the terminal services product itself was present so the script developer could determine if any of the other wts*() extender functions were safe to use. As of version 38005, it became possible for this script to function properly on a system that didn't actually terminal services installed; this would happen when the terminal services API libraries were copied to a non-TS system. To account for these changes, this function now accepts an optional request parameter. If the value of request is omitted, it defaults to a value of zero. This will allow for older scripts that omit this parameter to continue to function properly w/o having to be re-written. For newer scripts, though, it might be desirable to make a distinction between whether only the TS API is present, or whether both the TS API and the TS product are present. If only the TS API is present, then the extender functions with slightly limited functionality on WinNT v4.0 systems [e.g. wtsProcIdToSessId() doesn't work]. If both the TS API and the TS produt are present, then the extender is 100% fully functional. If the TS API is missing, then the extender cannot function.

It is advisable to call this function first in a script as this function is the only safe way to find out that terminal services are not enabled. Attempting to call any of the wts*() functions [except for wtsIsTSEnabled(), wtsVersion() and wtsLastErrMsg()] when the terminal services are not enabled will result in an error being generated in the script that made the wts*() function call.

On Win2K Professional, it is possible to copy over the file WTSAPI32.DLL from a Win2K [Advanced] Server system and place it in "%windir%\system32". If this is done, then the WTS Extender will load properly and be fully functional on the workstation. In that configuration, wtsIsTSEnabled() will return @TRUE and it will be possible for the workstation to perform all of the T.S. related administration functions.

On WinNT v4.0 Workstation / Server, it is possible to copy over several files that are used to implement the WTS*() API function library from a WinNT v4.0 Terminal Server Edition system and place them in "%windir%\system32". The result of doing this is the same as for copying over WTSAPI32.DLL on a Win2K system, except that the function wtsProcIdToSessId() will not function and will raise error 907. That happens due to the fact that KERNEL32.DLL does not export a Win32 API function on those systems that is required for wtsProcIdToSessId() to work properly. The following files need to be copied to make the WTS*() API functions available on a WinNT v4.0 Workstation / Server system: WTSAPI32.DLL, UTILDLL.DLL, WINSTA.DLL and REGAPI.DLL.

If the TS Client Virtual Channel is present then the wts*() functions that support enhanced communication between the TS session and the TS client system can be used safely.

Example:
;Load 32-bit or 64-bit extender
AddExtender( "WWWTS44I.DLL" , 0, "WWWTS64I.DLL" )

Title01 = 'Test wtsIsTSEnabled()' ErrorMode(@OFF) Result = wtsIsTSEnabled(0) RC = LastError() ErrorMode(@CANCEL) TempMsg = StrCat('wtsIsTSEnabled(0) RC = ',RC,@CRLF) TempMsg = StrCat(TempMsg,@CRLF,'Result = ',Result) Message(Title01,TempMsg) Exit
See Also:

wtsIsCitrixEnabled, wtsLastErrMsg(), wtsVersion()