Re: Re: Force Logoff

From: Jerold Schulman (Jerry_at_jsiinc.com)
Date: 12/10/04


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



Relevant Pages

  • Re: Unauthorized Monitoring of Email
    ... We do believe, on the other hand, that the son ... administrative account as well as the local admin account on the ... read permissions on the store to the Administrator account. ...
    (microsoft.public.windows.server.sbs)
  • Re: forgotten windows desktop password
    ... If you have Windows XP Home Edition, ... Administrator account. ... Have a stern talk with your son and consider ...
    (microsoft.public.windowsxp.security_admin)
  • Re: Change Administrator
    ... "B-Bob" wrote in message ... > My son will be "inheriting" this pc that I am using now, ... > All of the Gateway stores have closed ... I would like to let him "crown" himself as the administrator. ...
    (microsoft.public.windowsxp.newusers)
  • RE: acess for all
    ... It seems like the only thing you can do right now is ask your son to make ... User Name*> Change Type> Computer Administrator.) ... If internet explorer is not visible in the start menu, ...
    (microsoft.public.windowsxp.newusers)
  • Re: HELP - My son has taken control of administrator privileges and disallowed acces
    ... Be sure to password Safe Mode Administrator as well as any other ... account with Administrator access. ... You must tightly control ALL Administrator accounts. ... get your son a good pair of walking ...
    (microsoft.public.windowsxp.security_admin)