Question Locked

Force Logoff after being logged-on for a specified time

0 helpful
8 replies
Closed to new repliesThis discussion is closed. It stays readable, but it takes no new replies.

Anyone know how to - Force logoff after a specified number of minutes (not using Windows Steady State)
This is not about a specified time window for logon usage!(can be done in GP)

Seems a reasonable thing to do in Schools so people don't hogg the pc. But seems somehow difficult to achieve.

8 replies

by peconet tietokoneet

You say "Force Logoff after being logged-on for a specified time".
And then say "This is not about a specified time window for logon usage".

If you can be more specific, it would be more helpful to us and you..

by rob miners

There is a built in logoff.exe in XP and it can be used with a timer in a script that could be called at logon. There is no warning and the user is automatically logged of when the time is up.

Copy and past the information between ------- into notepad and save it with a .vbs extension.

-------------
Set oWshShell = WScript.CreateObject("WScript.Shell")
sCommand = "logoff.exe"

WScript.Sleep 9000 'Timer is adjusted to suit your needs

oWshShell.Run(sCommand)

-------------

by mike

Thanks Jacky - I'll try the script.I can always include a warning of the time allowed in the logon message. But a warning at "times up" would be nice.

To elaborate I want to be able to force user log-off after a time period of being logged -on for say, 1 hour, We have students that need to share the PC with others so I want a program to
(1) remind them that the system is going to log them off and that they should save their work. and
(2) then logs them off. and blocks them from logging on again for a time perdiod (say 30 min)

This will allow others who are waiting to have a turn. So the should time start when the user logs-on and then warn them say 5 min. 4,3,2,1 before it forcebly logs them off after the set time ( say 1 hour)

I know it is possiible in AD and GP to give users a "Time Widow" - a time period during
which they are allowed to log-on - but that's not the same thing.

many thanks
Mike

by rob miners

I can do the warning and a timeout period but you would have to use Active Directory to lock the users out.

Set oWshShell = WScript.CreateObject("WScript.Shell")
sCommand = "logoff.exe"

WScript.Sleep 3600000 'Timer is adjusted to suit your needs

hello = msgbox("You will be Automatically logged off in 2 minutes please save your Work.")

WScript.Sleep 150000

oWshShell.Run(sCommand)

by rob miners

You would probably do better to copy the script to the workstations and copy a shortcut to start it and place the shortcut in:

C:\Documents and Settings\All Users\Start Menu\Programs\Startup

Edit: to add

or after you copy it to the workstation you can modify the Registry to run it.

Click Start, Run type in regedt32 and press Enter.

Navigate to "HKEY_CURRENT_USER\SOFTWARE\Microsoft\Windows\CurrentVersion\Run"

In the right hand pane right click and add a new String value AutoLog, give it a Value of C:\script name.vbs

This discussion is closed to new replies.