DOS Terminal Session Does Not Close

G

Guest

Greetings, everyone.

I have a DOS app that I must share using TS. This app requires a custom
CONFIG.NT be created for it to work, which is associated through a PIF. I
have created an RDP connection in TS Config which executes the PIF for the
DOS app upon connection without a problem, but when the user closes the DOS
app the session stays active without any apparent way to gracefully close the
session. I would like to be able to avoid providing a complete Desktop if I
can just have the app launch via settings on the Environment tab. Is there
any way to accomplish this?

TIA,

- S
 
G

Guest

I don't believe it is possible to run cmd.exe as the user environment of an
RDP session, because cmd can't run full screen over RDP.
 
V

Vera Noest [MVP]

From http://ts.veranoest.net/ts_faq.htm

Q. My session doesn't logoff when I quit my starting or published
application

A. If you define a Starting application, either in Terminal
Services Configuration, a GPO or in your RDP client, your session
should be automatically logged off when you quit the application.
Sometimes, this doesn't happen and you are left with a session
which only shows the desktop background, without the possibility to
log off the session manually. The cause for this problem is a
process which is still running in your session, preventing it from
closing and logging off. The same can happen after quitting a
Citrix published application.

To solve the problem, open a second connection to the Terminal
Server and check in Task manager which process is keeping the
session from closing. Some anti-virus applications are known to
cause this behaviour.
If you can't avoid running the process, you can use a work-around
to log off your session.

Create a batch file, containing something like this:
cd <path_to_the_folder_containing_your_application>
start /wait <your_applications_executable>
logoff

Now define this batch file as the starting application.

For a different solution to the problem, and a list of known
processes which cause this behaviour, check:
CTX891671 - Graceful Logoff from a Published Application Keeps
Sessions in Active State
_________________________________________________________
Vera Noest
MCSE, CCEA, Microsoft MVP - Terminal Server
TS troubleshooting: http://ts.veranoest.net
___ please respond in newsgroup, NOT by private email ___
 
G

Guest

Vera,

Thank you very much for your reply. This was exactly the information that I
was looking for. You wouldn't also happen to know if there is a way to hide
or minimize the batch file's window so only the user's application is
visible, would you? ;)

Thanks again,

- S
 
V

Vera Noest [MVP]

Well, yes, but I'm not sure if I would use it myself, because it adds
another level of complexity. This is what you can do:

Define your starting application (first batfile) like this:
start /min <second_level_batfile>

And define your <second_level_batfile> like this:
start /wait <your_applications_executable>
logoff

Explanation: the first batfile (which is defined as the starting
application) just fires up the second batch file with the /min flag
and then it dies immediately. The second command window runs
minimized and starts your application. It waits for the application
to exit and then it logs the user off. Clumsy, but works. It's
possible that you can do the same thing a bit more sophisticated with
a vbs script.
_________________________________________________________
Vera Noest
MCSE, CCEA, Microsoft MVP - Terminal Server
TS troubleshooting: http://ts.veranoest.net
___ please respond in newsgroup, NOT by private email ___
 
G

Guest

Vera,

Thank you so much for taking the time to answer my questions. You have
given me what I needed to solve my problem and then some.

Cheers!

- S
 
G

Guest

Greetings,

Just to complete the posting, using Vera's suggestion, with a little
VBScript I was able to accomplish the "double batch file" approach with one
script. Great idea!

<code>

'=======================
'
' NAME: CloseTermSession.vbs
'
' AUTHOR: Steven Bendis
' DATE : 29-Nov-2005
'
' COMMENT: Ensures Windows terminal session closes when user exits DOS app.
'
'=======================

Sub Main

Dim objWshShell, objExec, strDOSApp

strDOSApp = "C:\The\DOS\App\Path\run.exe"

Set objWshShell = CreateObject("WScript.Shell")
Set objExec = objWshShell.Exec(strDOSApp)

Do While objExec.Status = 0
WScript.Sleep 500
Loop

Set objExec = objWshSHell.Exec("logoff")

End Sub

Main

</code>

Thanks again,

- S
 
V

Vera Noest [MVP]

Great! That's a much more elegant solution. Thanks, Steven!
Do you mind if I add this as an alternative solution to my TS FAQ?

_________________________________________________________
Vera Noest
MCSE, CCEA, Microsoft MVP - Terminal Server
TS troubleshooting: http://ts.veranoest.net
___ please respond in newsgroup, NOT by private email ___
 
R

Rob S

On Tue, 29 Nov 2005 10:56:20 -0800, "Vera Noest [MVP]"

-Great! That's a much more elegant solution. Thanks, Steven!
-Do you mind if I add this as an alternative solution to my TS FAQ?
-

Now this is what I call a thread. A post for assistance, an answer gratefully
received, and a nice solution selflessly posted. Nice!


-Rob
robatwork at mail dot com
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top