[THIN] Re: Autocreated printers not disappearing after disconnect

  • From: Euan Cooper <Euan.Cooper@xxxxxxxxxxxx>
  • To: "'thin@xxxxxxxxxxxxx'" <thin@xxxxxxxxxxxxx>
  • Date: Tue, 28 Sep 2004 16:33:23 +1200

Mark,

Not too sure about your logoff command - this seems to reset the ica & rdp
sub systems and not acually log off the users "gracefully" - I did a quick
test on a new server I'm setting up and got the same problem with std ICA
autocreated printers.

In my own loggoff script I use the following to log off users and do not
have a problem with left over autocreated printers.

REM Logoff diconnected sessions
FOR /F "eol= tokens=1,2,3 delims= " %%i IN ('quser') DO IF "%%k"=="Disc"
logoff %%j

REM Logoff active users
FOR /F "eol= tokens=1,3,4 delims= " %%i IN ('quser') DO IF "%%k"=="active"
LOGOFF %%j

If you want a record of what users are not logging off you could use
something like ...

REM Logoff any Disconected sessions 
REM Details of any such sesions are written to the log so we can see what
users are not logging off properly
qwinsta | find "Disc" > disc.lst
Type disc.lst                                          >>
c:\tdw\Shutdown.txt
for /f "tokens=2" %%i in (disc.lst) do logoff %%i 
del disc.lst
Echo.                                                  >>
c:\tdw\Shutdown.txt   

:: Logoff any Active sessions
:: Details of any such sesions are written to the log so we can see what
users are not logging off at night.
qwinsta|find "Active" > active.lst
Type active.lst                                        >>
c:\tdw\Shutdown.txt 
for /f "tokens=2" %%i in (active.lst) DO LOGOFF %%i 
del active.lst 

:: Clear any hung ICA sessions by re-settting ica-tcp
echo y|reset session ica-tcp 

Hope this helps

-Ec


-----Original Message-----
From: Landin, Mark [mailto:Mark.Landin@xxxxxxxxxxxxxxxx]
Sent: Saturday, 25 September 2004 6:30 a.m.
To: thin@xxxxxxxxxxxxx
Subject: [THIN] Autocreated printers not disappearing after disconnect


We reboot our servers every night (because, fortunately, we can).

Apparently, when we force users to log off the system, it is not always
cleaning up their autocreated printers correctly. (These are being
created by Tricerat's Simplify Printing utility, not the standard TS or
ICA auto-creation). After a few days, you can tell the users who were on
the system when it got rebooted: they have multiple sets of printers
defined.

Here's my reboot script:
===================================================
REM  Script to do orderly shutdown, cleanup, update, and reboot of
Terminal Server
REM
REM  Don't let new users log on
REM
change logon /DISABLE

msg * WARNING: System maintenance beginning in 10 minutes. Please exit
all EBMS applications and log off NOW. Thank you
SLEEP 300
msg * WARNING: System maintenance beginning in 5 minutes. Please exit
all EBMS applications and log off NOW. Thank you
SLEEP 180
msg * WARNING: System maintenance beginning in 2 minutes. Please log off
NOW!
SLEEP 60
msg * WARNING: LOG OFF NOW, or you will be LOGGED OFF in 1 minute!
SLEEP 60
REM
REM  Log off all users ... they were warned! First, get a list of
"offenders"
REM
now *** Users still on at reboot: >> c:\tdw\stillon.log
quser >> c:\tdw\stillon.log
logoff ica-tcp <c:\tdw\yes
logoff rdp-tcp <c:\tdw\yes
now *** Users still on after clear: >> c:\tdw\stillon.log
REM
REM  Everyone should be off now, and no one can get back on
REM  

REM
REM  Backup the farm's IMA data store. 
REM
dsmaint backup C:\tdw

REM
REM  Clean up dead spooler and temp files
REM
net stop spooler
del c:\winnt\temp\*.* /q
del c:\winnt\system32\spool\printers\*.* /q

REM
REM  Are cleared disonnected sessions not getting enough time to clean
up 
REM  after themselves? Seems unlikely, but let's be sure...
REM
SLEEP 180

REM
REM  Update client software, if needed
REM
call c:\tdw\update.cmd

REM
REM  Reboot
REM
tsshutdn 5 /REBOOT
==============================

Am I not giving enough time (SLEEP 180) for the disconnecetd sessions to
be cleaned up? Is there some other command I can use to remove all
auto-created printers right before the reboot?

---
The T drive is not backed up 
********************************************************
This Weeks Sponsor RTO Software
Do you know which applications are abusing your CPU and memory?
Would you like to learn? --   Free for a limited time!
Get the RTO Performance Analyzer to quickly learn the applications, users,
and time of day possible problems exist.
http://www.rtosoft.com/enter.asp?id20
********************************************************** 
Useful Thin Client Computing Links are available at:
http://thin.net/links.cfm
***********************************************************
For Archives, to Unsubscribe, Subscribe or 
set Digest or Vacation mode use the below link:
http://thin.net/citrixlist.cfm
********************************************************
This Weeks Sponsor RTO Software
Do you know which applications are abusing your CPU and memory?
Would you like to learn? --   Free for a limited time!
Get the RTO Performance Analyzer to quickly learn the applications, users,
and time of day possible problems exist.
http://www.rtosoft.com/enter.asp?id=320
********************************************************** 
Useful Thin Client Computing Links are available at:
http://thin.net/links.cfm
***********************************************************
For Archives, to Unsubscribe, Subscribe or 
set Digest or Vacation mode use the below link:
http://thin.net/citrixlist.cfm

Other related posts: