Re: screen saver for auto log off after a certain period of idle time

From: Torgeir Bakken \(MVP\) (Torgeir.Bakken-spam_at_hydro.com)
Date: 03/08/05


Date: Tue, 08 Mar 2005 17:32:34 +0100

JC wrote:

> I want to automatically logoff a session when it has been idle for a
> configurable time.
>
> In several sources out there I've seen that the better way to do this is to
> use a screen saver like "winexit", but I haven't been able to use it and to
> work without the "Force application termination" option. The problem with
> this option is that the system does not wait the application to terminate,
> and I need that because the application must do some things before ending.
>
> The configuration I've used is to configure a screen saver ("winexit.scr")
> and screen saver activation time in Active Directory (Windows 2000 server)
> in a "group policy"
> b) Clients are Windows XP clients
>
> I need a better solution to do this. Has anyone solved a problem like mine
> (automatic logoff but waiting the applications to finish) ?
Hi

You could create an scheduled task that starts at user logon and is
configured to kick in at a set idle time. Let the scheduled task
launch a script that handles the closing of the app and then logs the
user off.

If you want to use WinXP's shutdown.exe utility, and the user to be
logged off is not the same as the one that is defined in the task,
you might need to enable the remote shutdown privilege for the task
user even if you are going to only operate on the local computer.
If the task user is a member of the local Administrators group, I
think the privilege is already in place.

Take a look here for how to add remote shutdown privilege:
http://groups.google.co.uk/groups?threadm=uq2jIcw2EHA.1564%40TK2MSFTNGP09.phx.gbl

Anyway, Psshutdown.exe in SysInternals's free PSTools suite does not
suffer under this limitation and is the tool I recommend to use in
this case.

http://www.sysinternals.com

Alternatively, to avoid any 3rd party tool, you can use a VBScript
instead (I don't think it have the same issue as shutdown.exe, but I
am not 100% sure):
http://groups.google.co.uk/groups?selm=uq2jIcw2EHA.1564%40TK2MSFTNGP09.phx.gbl

For the application closing part:

The free command line utility Cmdow.exe is an option, using the /CLS
or /END switch.

http://www.commandline.co.uk/cmdow/index.html

More about this here:
http://groups.google.co.uk/groups?threadm=cace82a5.0410130525.43a7fe48%40posting.google.com&rnum=1&prev=/groups%3Fhl%3Den%26lr%3D%26c2coff%3D1%26selm%3Dcace82a5.0410130525.43a7fe48%2540posting.google.com

Another option is to use use AutoIt/AutoItX and e.g. it's
WinClose function.

Here is an example on WinClose:
http://groups.google.co.uk/groups?selm=3DA05988.9BD87F86%40hydro.com

AutoIt/AutoItX is free and can be found here:
http://www.hiddensoft.com/autoit3/index.php

AutoItX is an ActiveX control version of AutoIt and can be used from a
vbscript.

Note:
AutoIt(X) window handling defaults to match the start of a window title that
you specify, use "SetTitleMatchMode 2" to specify ANY substring of the window
title you want to match. Also, the Windows titles and text are case sensitive.

-- 
torgeir, Microsoft MVP Scripting and WMI, Porsgrunn Norway
Administration scripting examples and an ONLINE version of
the 1328 page Scripting Guide:
http://www.microsoft.com/technet/scriptcenter/default.mspx


Relevant Pages

  • Re: screen saver for auto log off after a certain period of idle time
    ... "catch" the event "the PC has been idle for X time" on a client. ... > Another option is to use use AutoIt/AutoItX and e.g. it's ... > AutoItwindow handling defaults to match the start of a window title ... > torgeir, Microsoft MVP Scripting and WMI, Porsgrunn Norway ...
    (microsoft.public.windowsxp.security_admin)
  • Re: restore window
    ... > window from the taskbar and activate it. ... Is this possible with scripting, ... You can do this with AutoIt/AutoItX... ... API to make it unminimize, but you need to use some OS APIs (as ...
    (microsoft.public.scripting.wsh)
  • Re: objProcess.Terminate()
    ... Another option is to use use AutoIt/AutoItX and e.g. it's WinClose function. ... AutoItwindow handling defaults to match the start of a window title that you specify, use "SetTitleMatchMode 2" to specify ANY substring of the window title you want to match. ... torgeir, Microsoft MVP Scripting and WMI, Porsgrunn Norway Administration scripting examples and an ONLINE version of the 1328 page Scripting Guide: ...
    (microsoft.public.windows.server.scripting)
  • Re: Is this possible??
    ... >> May I control the object in OS, such as switching between window, ... > Take a look at AutoIt/AutoItX, it can help you with that. ... > AutoItwindow handling defaults to match the start of a window title ... > torgeir, Microsoft MVP Scripting and WMI, Porsgrunn Norway ...
    (microsoft.public.scripting.vbscript)
  • Re: Close a window if it is already open
    ... > it is not worst to have a new window than a new layer ... environments has resulted in pop-up blocking. ... It has been the lesson of the history of browser scripting that whenever ... This takes the reality that pop-up blockers render the ...
    (comp.lang.javascript)

Loading