Windows 7 Forums
Welcome to Windows 7 Forums. Our forum is dedicated to helping you find support and solutions for any problems regarding your Windows 7 PC be it Dell, HP, Acer, Asus or a custom build. We also provide an extensive Windows 7 tutorial section that covers a wide range of tips and tricks.


Windows 7: Auto log off disconnected sessions

11 Jan 2011   #1
EarlThePearl

WinXPPro/Win7Pro
 
 
Auto log off disconnected sessions

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 System SpecsSystem Spec
.
11 Jan 2011   #2
tchafey

Windows 7 Professional x86
 
 

Disable Switch-User?
My System SpecsSystem Spec
11 Jan 2011   #3
EarlThePearl

WinXPPro/Win7Pro
 
 

Quote   Quote: Originally Posted by tchafey View Post
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 System SpecsSystem Spec
.

11 Jan 2011   #4
tchafey

Windows 7 Professional x86
 
 

Quote   Quote: Originally Posted by EarlThePearl View Post
Quote   Quote: Originally Posted by tchafey View Post
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 System SpecsSystem Spec
11 Jan 2011   #5
EarlThePearl

WinXPPro/Win7Pro
 
 

Quote   Quote: Originally Posted by tchafey View Post
Quote   Quote: Originally Posted by EarlThePearl View Post
Quote   Quote: Originally Posted by tchafey View Post
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 System SpecsSystem Spec
12 Jan 2011   #6
WindowsStar

Windows 7 Enterprise (x64); Windows Server 2008 R2 (x64)
 
 

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 System SpecsSystem Spec
18 Jan 2011   #7
WindowsStar

Windows 7 Enterprise (x64); Windows Server 2008 R2 (x64)
 
 

Did the Script Work??
My System SpecsSystem Spec
06 May 2011   #8
Childroland67

32 bit
 
 

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 System SpecsSystem Spec
08 May 2011   #9
WindowsStar

Windows 7 Enterprise (x64); Windows Server 2008 R2 (x64)
 
 

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 System SpecsSystem Spec
30 Apr 2014   #10
DLKirchmer

Windows 8.1 Enterprise x64
 
 
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 System SpecsSystem Spec
Reply

 Auto log off disconnected sessions




Thread Tools




Similar help and support threads
Thread Forum
is it possible to have multiple sessions of chrome?
Is it possible to have multiple sessions of chrome open at once? Not websites but the actually application itself? is there a hack or trick to doing this? anyone know? Before you ask WHY!? Im trying to have my google application shortcuts to run in thier own tab on the taskbar. I hate that...
Installation & Setup
RDP sessions via SSLVPN failing
Hi, I'm trying to get a terminal server session via SSLVPN going. I browse to a website using https (I use IE 11) and authenticate. I then get presented with a link which when clicked, launches an RDP session to a remote host. This RDP session fails to establish. It worked fine when I was on XP...
Network & Sharing
Multiple Independent Chrome Sessions
Hi, is it possible to open multiple Chrome sessions? I want an extension to be enabled in one session & disabled in the other. Thanks
Browsers & Mail
Log into multiple RDP sessions and without interrupting user
Hello, I would just like to tell you all of a very useful tool. It patches termsrv.dll (RDP) to allow the following features. I take NO CREDIT for this tool btw. The tool does multiple things. It allows you to: 1. Fully use Remote Desktop Connection on Windows 7 Home Premium and Basic...
Network & Sharing
Multiple Windows 7 pro 64 bit sessions
Hi guys, I would like to know how can I have two windows sessions active at the same time. I've found some tutorials in google with a installer file, but when I run it as admin although it says the operation was ok, there are some errors, and in the end I always get the common error when trying to...
General Discussion
Firefox opening old sessions
I upgraded to Windows 7 with FF 3.5.2 installed. When I start up FF, occasionally old pages will load up, even if I close FF with no pages open and have cleared my old tab sessions. When I start FF it won't just open up the pages that I was last on but pages from hours before hand. Anyone else have...
Browsers & Mail


Our Sites

Site Links

About Us

Find Us

Windows 7 Forums is an independent web site and has not been authorized, sponsored, or otherwise approved by Microsoft Corporation. "Windows 7" and related materials are trademarks of Microsoft Corp.

Designer Media Ltd

All times are GMT -5. The time now is 16:37.
Twitter Facebook Google+ Seven Forums iOS App Seven Forums Android App