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.

NT4 Citrix server and Error 116 with wtsQuerySessionInfo

Keywords:   NT4 Citrix server error 116 wtsQuerySessionInfo

Question:

I'm trying to run the following on an NT4 Citrix server and get error 116, any ideas?
AddExtender('WWWTS34I.DLL')
sesInfo=wtsQuerySessionInfo("",221)
I've also tried specifying the server name and get the same result. 221 is a valid session at the time the script was run.

It doesn't work on a older NT4 Citrix box, but it does work on a newer Windows 2000 terminal server.

Here is the full code snippet I'm using, but I was trying to narrow down the cause of the problem...

sysRoot=Environment("SystemRoot")
log=StrCat(sysRoot,"\sessioninfo.txt")
Title01 = 'Test wtsEnumSessions()'

ErrorMode(@OFF)

Result = wtsEnumSessions('')
RC = LastError()

;ErrorMode(@CANCEL)

TempMsg = StrCat('wtsEnumSessions("") RC = ',RC,@CRLF)

sesCnt=Result[0]

For i = 1 to sesCnt
sesId=ItemExtract(i,Result[1],@Tab)
;If sesId < 10 Then Continue
sesName=ItemExtract(i,Result[2],@Tab)
sesStat=ItemExtract(i,Result[3],@Tab)
IniWritePvt("SessionInfo",i,StrCat(sesId," , ",sesName," , ",sesStat),log)
sesInfo = wtsQuerySessionInfo("",sesName)
conState = sesInfo[1]
cltAddr = sesInfo[2]
cltName = sesInfo[3]
cltBld = sesInfo[7]
usrName = sesInfo[14]
IniWritePvt("SessionDetail",i,StrCat(sesName,",",conState,",",cltAddr,",",cltName,",",cltBld,",",usrName),log)
Next
Do you know what dependances the terminal services extender have? What .dll's it relies on and calls?

I have a feeling that our early version of Citrix is not compatible with the extender.

I have:

Windows Terminal Server Build 419 SP6
Citrix Metaframe 1.80 Build 663

Answer:

I tested the WTS extender on Win2K Advanced Server SP3, WinNT v4.0 SP6a Terminal Server Edition, Win2K Pro SP3, Win2K Server SP3, WinXP Pro SP1 and WinXP Home SP1.

The WTS extender was not explicitly tested on any version of Citrix based on WinNT v4.0, although it has been run on a Citrix MetraFrame/XP system that is based on Win2K SP2 Advanced Server.

The underlying DLL that is used is the WTSAPI32.DLL file.

Are you attempting to get the session information while logged on as an administrator or as a regular user?

What is the contents of the WWWBATCH.INI file? There should be some diagnostic information in there that helps to further identify what API function failed and what the error code was. With that information I can help you to troubleshoot what's going wrong.

Question (cont'd):

found the wwwbatch.ini under my profile, here is the contents:
[Error Reporting]
3052=sessid
[Windows Terminal Server Extender]
LastError=B7 "WTSQuerySessionInformationAX() {WTSApplicationName} : WWWTS_QuerySessionInfo()"
I am running the script from the console, logged in as administrator.

Answer:

I looked up the 0x000000B7 error code [183 decimal] in the Win32 error code table, but it makes no sense. The error code is documented as follows:
183 Cannot create a file when that file already exists. ERROR_ALREADY_EXISTS 
That description seems to be totally irrelevant. My guess is that the WTS*() API functions have their own set of error codes, or perhaps Citrix has a different set of error codes that they use as compared to what Microsoft has defined for the WTS*() functions to use. I've put out some inquiries on the 'Net and I'll see what I can find out about this problem.

This problem may be isolated to just your environment, or it may be very specific to just Citrix Metaframe on WinNT v4.0 Terminal Server Edition. I have not seen this problem on Win2K running Citrix Metaframe/XP.

I have been unable to find out what the actual meaning of the error code is.

As best as I can tell, it is not so much a Win32 error as it is a Citrix error code that is being generated. Unfortunately, I've not been able find anything that really identifies what this error code means.

As a work around for the problem, I've simply modifed the code for the wtsQuerySessionInfo() function so that it suppresses all errors and returns either an empty string or a value of zero for any item of string/numeric information that it cannot obtain due to one of these odd-ball errors having occurred. Diagnostic information is still written to WWWBATCH.INI when an error occurs, but your script won't know that an error has occurred when calling this function.


Article ID:   W15430
File Created: 2003:05:13:11:27:42
Last Updated: 2003:05:13:11:27:42