Auto log off disconnected sessions

EarlThePearl

New member
Member
Local time
11:57 PM
Messages
9
Location
TX
From all my research this doesn't look possible, but I thought I would ask anyway.

Environment:

- Windows domain environment - 2 2008 R2 AD servers, 1 2003 AD server, 2003 functional level for now
- Mostly XP machines, new medical tablets and all-in-one pcs will have windows 7 32-bit

Is there a way to auto log off disconnected client user sessions in windows 7? I know there is a way to log off disconnected sessions in terminal services using an idle timer, but from everything I've read you can't do this on a client. I found Grim's screen saver log off solution here and it works if no one uses the fast user switching ability. My problem is that the medical tablets probably will not sit long enough for the auto log off to kick in. A user will come by pick up a machine that the last user didn't log off (and never will, even if I tell them they will lose their jobs if they don't!) and do a switch user function, leaving a disconnected session. This will probably happen multiple times, leaving many disconnected sessions and a slow device. I would disable fast user switching, but our single sign on software must have fast user switching enabled in order to function properly. So much so that it overrides group policy and registry edits.

So I was hoping to find an easy solution. All I need is for some kind of timer to be set on the disconnected sessions. Once the timer is up the disconnected session is forced to log off. Works this way on TS, not sure why you can't do this on a client.
 

My Computer My Computer

OS
WinXPPro/Win7Pro
Disable Switch-User?
 

My Computer My Computer

Computer Manufacturer/Model Number
Dell E6510
OS
Windows 7 Professional x86
CPU
Intel(R) Core(TM) i5 M 520 @ 2.40GHz
Memory
4.0GB DDR3-1333
Graphics Card(s)
NVIDIA NVS 3100M 512MB
Sound Card
NVIDIA HD Audio
Disable Switch-User?

fail

I would disable fast user switching, but our single sign on software must have fast user switching enabled in order to function properly. So much so that it overrides group policy and registry edits.
 

My Computer My Computer

OS
WinXPPro/Win7Pro
Disable Switch-User?

fail

I would disable fast user switching, but our single sign on software must have fast user switching enabled in order to function properly. So much so that it overrides group policy and registry edits.

Disable access to the button, not the service?
 

My Computer My Computer

Computer Manufacturer/Model Number
Dell E6510
OS
Windows 7 Professional x86
CPU
Intel(R) Core(TM) i5 M 520 @ 2.40GHz
Memory
4.0GB DDR3-1333
Graphics Card(s)
NVIDIA NVS 3100M 512MB
Sound Card
NVIDIA HD Audio
Disable Switch-User?

fail

I would disable fast user switching, but our single sign on software must have fast user switching enabled in order to function properly. So much so that it overrides group policy and registry edits.

Disable access to the button, not the service?

Let me try and explain this further.

There are 2 ways that I know of to disable user switching in Windows 7, found on this site for reference:

How To Enable/Disable Fast User Switching In Windows 7, Vista, XP

1. Group Policy - you can disable this way, either local or from the AD server, but my SSO software will pretty much ignore and override it.

2. Registy Edit - you can make the new entry to hide and disable user switching, but the SSO software will delete this edit 1st chance it gets.

So the end result is user switching WILL be enabled if the SSO software is installed...period. (I don't agree with it either but it is what it is) If there is some way to block SSO from overriding it or stop it from deleting the registry key the SSO software will just stop working.
 

My Computer My Computer

OS
WinXPPro/Win7Pro
Run this script as a service:

LogoffTimer.cmd

Code:
@echo off
:Top
for /f "tokens=1-7 delims=,: " %%a in ('query user ^| find /i "disc"') do if %%d GTR 32 (logoff %%b) else %%e GTR 32 (logoff %%b)
choice /T 120 /C 1 /D 1 /N
goto top
 

My Computer My Computer

Computer type
PC/Desktop
Computer Manufacturer/Model Number
Dell OP7010
OS
Windows 7 Enterprise (x64); Windows Server 2008 R2 (x64)
Memory
16GB
Monitor(s) Displays
4 Dell 24" LCD
Screen Resolution
1280x1024
Keyboard
Dell
Mouse
Dell Optical
Internet Speed
40meg
Did the Script Work??
 

My Computer My Computer

Computer type
PC/Desktop
Computer Manufacturer/Model Number
Dell OP7010
OS
Windows 7 Enterprise (x64); Windows Server 2008 R2 (x64)
Memory
16GB
Monitor(s) Displays
4 Dell 24" LCD
Screen Resolution
1280x1024
Keyboard
Dell
Mouse
Dell Optical
Internet Speed
40meg
This is what I'm getting when I try to run the script. Anyone actually get this to work?

Thanks,
Isaac

>for /F "tokens=1-7 delims=,: " %a in ('query user | find /i "disc"') do if %d GTR 32 (logoff %b ) else %e GTR 32 (logoff %b)

>if 3 GTR 32 (logoff 5 ) else 5/6/2011 GTR 32 (logoff 5)
'5' is not recognized as an internal or external command,
operable program or batch file.

>choice /T 120 /C 1 /D 1 /N
 

My Computer My Computer

OS
32 bit
Did you run it as a script or {type or cut and paste} to the command line? You have to run this as a script. What version of Server are you using? -WS
 

My Computer My Computer

Computer type
PC/Desktop
Computer Manufacturer/Model Number
Dell OP7010
OS
Windows 7 Enterprise (x64); Windows Server 2008 R2 (x64)
Memory
16GB
Monitor(s) Displays
4 Dell 24" LCD
Screen Resolution
1280x1024
Keyboard
Dell
Mouse
Dell Optical
Internet Speed
40meg
How to make the .cmd file into a service

I have the script (.cmd) file running in an elevated command box.

How do you go about running it as a service?
 

My Computer My Computer

Computer type
PC/Desktop
Computer Manufacturer/Model Number
HP
OS
Windows 8.1 Enterprise x64
CPU
Core i5 Pro
Memory
8 GB
WindowsStar, Could you explain your script to me? I'm looking to automatically log off users in a shop floor environment, and suspect this might be what I'm looking for, but I'm running into the same problem as Childroland67.

Thanks in advance
 

My Computer My Computer

Computer type
Laptop
Computer Manufacturer/Model Number
Asus G53SX
OS
7 Pro x64
CPU
Core i7-2630QM
Memory
16GB DDR3
Graphics Card(s)
GTX560M
Hard Drives
Crucial M4-64GB
Antivirus
System Center Endpoint Protection 2012
Back
Top