Re: Re: Force Logoff
From: Jerold Schulman (Jerry_at_jsiinc.com)
Date: 12/10/04
- Next message: Jack: "Uninstalling Office with GPO"
- Previous message: Roger Abell: "Re: Group Policy tab grayed out for Domain Admin"
- In reply to: Pete: "Re: Force Logoff"
- Next in thread: Pete: "Re: Re: Force Logoff"
- Reply: Pete: "Re: Re: Force Logoff"
- Messages sorted by: [ date ] [ thread ]
Date: Fri, 10 Dec 2004 10:44:40 -0500
On Thu, 9 Dec 2004 17:25:08 -0800, "Pete" <Pete@discussions.microsoft.com> wrote:
>I am running Small Business Server out of my home and thought I would take
>advantage of the group policies to help administer our son's computer. My
>wife asked me if, rather than her constantly reminding him his time was up,
>if I could set it up so his computer logged him off after a certain time
>period.
>
>"Lanwench [MVP - Exchange]" wrote:
>
>> Pete wrote:
>> > Hi, I am running SBS 2003 with users on XPSP2 I been looking for a
>> > way to force a "logoff" after a user has been logged in for say 30
>> > minutes. I have found plenty ways to do it after a certain amount of
>> > inactivity - however I am looking for a way to force a log off
>> > regardless of the level of activity.
>>
>> So you want the user to be forcibly logged off even if he's in the middle of
>> writing a memo in Word?
>> I can't think of anything native that will do this, and have to wonder what
>> your goal is here....
>>
>>
>>
You can't do it with group policy, but you can do it with a script, the task Scheduler, and some freeware,
assuming that your son is NOT a local admin.
Download PsShutdown.exe from tip 4086 in the 'Tips & Tricks' at http://www.jsiinc.com
and PsLoggedOn.exe from tip 4712. Place these in a folder that is in the system PATH.
Create SonOff.bat in the same folder:
@echo off
set User=NONE
:: Replace SON in the following line with your son's UserID
for /f "Tokens=*" %%a in ('psloggedon -L -X \\%computername%^|FIND /I "SON"') do (
set User=%%a
)
if "%User%" EQU "NONE" goto :EOF
:: REPLACE 1801 (30 minutes + 1 second) with the length of time desired
@ping -n 1801 127.0.0.1>nul
net send %computername% %UserName%, you have 2 munutes to save your work before being logged off.
@ping -n 121 127.0.0.1>nul
psshutdown -o
Log on to your son's computer as Administrator.
Create a Scheduled Task to run SonOff.bat "when I log on"
Set the credentials to the Administrators.
How it works.
When someone anyone logs onto your son's computer, the
SonOff.bat file will be run by the Scheduler.
As the task runs with Administrator credentials, your son or your wife or you
will not see this task running. The Administrator would see a brief flash.
The for command, parsed by the FIND command will return the variable User only if your son has logged on.
If anyone else logs on, Sonoff.bat will exit without doing anything.
If you son logged on, the ping will silently count down 1800 seconds
and then send him a pop-up, wait 120 seconds and then
the psshutdown -o command would log of the console user (your son).
Jerold Schulman
Windows Server MVP
JSI, Inc.
http://www.jsiinc.com
- Next message: Jack: "Uninstalling Office with GPO"
- Previous message: Roger Abell: "Re: Group Policy tab grayed out for Domain Admin"
- In reply to: Pete: "Re: Force Logoff"
- Next in thread: Pete: "Re: Re: Force Logoff"
- Reply: Pete: "Re: Re: Force Logoff"
- Messages sorted by: [ date ] [ thread ]
Relevant Pages
|