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: Batch file to automatically log a user off after a time of inactivity

15 May 2013   #1
blockie

 
Batch file to automatically log a user off after a time of inactivity

Those of you who have read my posts over the past couple of weeks know what am doing on a computer belonging to an Assisted Living facility.
I have the user accounts set up plus I have removed the "Switch User and Sleep menu items from the context menu of "START.......SHUTDOWN. I have reminded the users to log off several times. I have used BRINKS tutorial to create a LOG OFF shortcut and pinned the shortcut to the task bar. Some of the users STILL fail to logoff when they are done using the computer. I am now wanting to log them out of their account after an adjustable period of inactivity Maybe you wizards can come up with a tutorial to accomplish this.
What I am thinking is a screensaver type of auto log-off. The screensaver would come on after a predetermined period of inactivity. It would have a warning msg and display a countdown. At the end of the countdown the log-off command would be initiated.
External (administrator) inputs
1. Length of inactivity.
2. Length of warning, time it is displayed.
3. Maybe text of the warning.


My System SpecsSystem Spec
.
15 May 2013   #2
gregrocker

 

Hi Blockie -

Since Sleep or Hibernate would save the same user session and not Log Off it's probably not what you want even though the PC would be suspended until awakened or resumed.

Doing a search I found two methods that might work for you that also provide templates for either Task Scheduler in any version, or Group Policy controls if you have Pro or Ultimate.

automatic logout after inactivity/idle using Task Scheduler

WizardSoft - AutoLogoff cleanup & end inactive Windows sessions using Group Policy.
My System SpecsSystem Spec
16 May 2013   #3
blockie

 

Thanks Greg,
I forgot to mention that the computer in question is running W7 Premier 64bit. That makes it not able to take advantage of Group Policy, I believe. It also saves from paying $260 for the program.
The first suggestion about using the Task Scheduler was interesting although the thread turned into a pi..ing contest and I was not able to separate the wheat from the chaff, so to speak.
Bill
My System SpecsSystem Spec
.

16 May 2013   #4
Kari

Microsoft Community Contributor Award Recipient

 

The Task Scheduler alternative works, using Idle Timers, with one small issue: system checks the idle timer only once every 15 minutes. Whatever conditions you use, it is never exact.

For instance I use these settings but sometimes it takes almost half an hour idle time before system logs me out:
Batch file to automatically log a user off after a time of inactivity-2013-05-14_151225.png


My System SpecsSystem Spec
16 May 2013   #5
blockie

 

OK. Now, before I start. Is the TS choice universal? That is does it work for all the users accounts? Usually a second user does not start right away. If a second user logged into his/her account and began to do work, would he/she be logged out also? That would open another bag of worms.
Bill
My System SpecsSystem Spec
16 May 2013   #6
Kari

Microsoft Community Contributor Award Recipient

 

You need to use two triggers, On Idle and At log on.

Set first On Idle trigger:
Batch file to automatically log a user off after a time of inactivity-2013-05-14_150011.png
Do the same procedure for At log on trigger:
Batch file to automatically log a user off after a time of inactivity-2013-05-14_150213.png
It results this:
Batch file to automatically log a user off after a time of inactivity-2013-05-14_150258.png
Kari


My System SpecsSystem Spec
16 May 2013   #7
blockie

 

Did it and it worked, at least once. Will leave it enabled to be sure. Now for the ACTION. I would like to call a screensaver, have it run for 30 seconds displaying a warning and let it start the log off as it closes. Spent most of the afternoon looking for such a screensaver or a program to create a SS with the necessary options. Couldn't find one. Maybe one of you wizards can suggest something. Hoping !
Bill
My System SpecsSystem Spec
17 May 2013   #8
Kari

Microsoft Community Contributor Award Recipient

 

That could be tricky. The program would be launched when the system is already starting the log off process.
My System SpecsSystem Spec
17 May 2013   #9
blockie

 

Kari,
I think you misunderstand what I am thinking. I would like the ACTION tab of the task to operate in this fashion.
1. Start a screensaver
a. This SS would only be about 30 second long
b. It would display a warning that the system is about to log off, with a timer to countdown to zero, if possible.
2. At time zero, see 1b above, or if countdown timer is not available, initiate the program to log off after the SS closes, see 1a above.
My System SpecsSystem Spec
17 May 2013   #10
Kari

Microsoft Community Contributor Award Recipient

 

No, I understood you. It's just that I have been testing an playing this idle timer so much I doubt it works as you planned. Tasks with idle timer are IMO the most difficult to get working as you'd like to.
My System SpecsSystem Spec
Reply

 Batch file to automatically log a user off after a time of inactivity




Thread Tools Search this Thread
Search this Thread:

Advanced Search




Similar help and support threads
Thread Forum
Batch File to set user's windows login pic
Alright, I'm doing a little bit of research to help automate some customizations that I'm doing for my client's computers. I've got most of what I need done. But what I am trying to do now is set the user's current profile picture to one that is already there. The picture itself isn't going to...
Customization
Automatically giving rights to a user profile to change system time
Hi, I couldn't find the solution for the following problem: I have a software which reguires the user profile to have rights to change system time. Software is run as a non-admin user profile so software's installer should give the proper rights. Installer is run as admin. Can this be done and if...
General Discussion
Batch File that grabs file names from folder to insert into batch file
Ok I'm totally at a loss on how to word this so I'm just going to write it out the best that I can... :confused: First I have a batch file that I'm writing that will convert mp4 files to mp3 files (I have a lot) for a buddies band using ffmpeg. Here's the code that I'm using: ffmpeg -i...
General Discussion
Batch file to create a folder with name of the time.
I'm trying to write a batch file that when run creates a folder named "Backup" followed by the time it was created, and then copies files to that folder. When I run md "C:\Users\MasterControlProgram\Documents\MC Server With Backup\Backups\Backup %DATE%\" xcopy /e /v /y...
Backup and Restore
Help with Batch file, if statement in a specific time.
hi, I am working on a batch file, such as If this is not possible, then just simply, Thanks!
General Discussion
Batch file to run MMC as a different domain user?
I'm stumped. I have a batch file that I used on XP to run an MMC that I created for common management tasks. In the MMC I have the ability to run regedit as a root forest domain privileged user (for remote system registry editing), password resets (using AD) remote computer management, and...
General Discussion


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 07:45.

Twitter Facebook Google+



Windows 7 Forums

Seven Forums Android App Seven Forums IOS App