Re: Windows log off

Tech-Archive recommends: Fix windows errors by optimizing your registry

From: Kelly (kelly_at_mvps.org)
Date: 01/06/05


Date: Thu, 6 Jan 2005 01:46:36 -0600

Hi Daniel,

Automatically log off a user or shut down your machine: You can incorporate
Rundll32 into your Windows Script Host (WSH) or command-shell scripts to log
off the current user or shut down and restart the computer. The value in the
command's last parameter controls the action that will occur: 0 performs a
logoff, 1 performs a shutdown, 2 performs a reboot, 4 performs a forced
shutdown, and 8 powers down the machine. The following example performs a
logoff:

rundll32.exe shell32.dll,
SHExitWindowsEx 0

Added info:

You can schedule a task to lock the desktop after a period of
inactivity.

Start/All Programs/Accessories/System Tools/Scheduled Tasks. On the last
screen, check off Show Advanced Options. Under Advanced/Settings/Idle Time
(Only start... and Stop the task...).

You can schedule a task for inactivity. Use this to lock the
desktop after 10 minutes of idle time.

Use this shortcut for the task:

%windir%\System32\rundll32.exe user32.dll,LockWorkStation

C:\Windows\System32\rundll32.exe user32.dll,LockWorkStation.

To log off and run the risk of having your programs end prematurely and
without saving any unsaved material, you could use the same scheduled task
command and replace the LockWorkStation with ExitWindows. That will log off
the currently logged on user.

To schedule a logoff procedure for XP, use this:
C:\Windows\System32\shutdown -l as the scheduled task.

A scheduled task can be run without passwords:

For Pro: Start/Control Panel/Administrative Tools/Local Security
Policy/Local Policies/Security options. In the right hand pane (third down).

Accounts: Limit local account use of blank passwords to console logon only.
This is enabled by default, disable it.

For Home: Run Scheduled Task without a Password (Line 68)
http://www.kellys-korner-xp.com/xp_tweaks.htm

Easy Log Off, Shutdown and Restart (Line 89)
http://www.kellys-korner-xp.com/xp_tweaks.htm

-- 
All the Best,
Kelly (MS-MVP)
Troubleshooting Windows XP
http://www.kellys-korner-xp.com
"Daniel" <Daniel@discussions.microsoft.com> wrote in message 
news:533E5D40-A5DE-4D04-BFF9-1C6CF0F1EB51@microsoft.com...
> Is there a way to force automatic log off for an idle session?
> I need to set up a WinXP computer wihich is in Windows 2003 domain with an
> ability to force a log off of a user which stopped using the computer but
> didn't log off.  I need to allow some kind of session time out in a case 
> of
> extended inactivity (lets say 10 minutes).  I wonder if there are any 
> built
> in mechanisms to do it?
> This is in an environment where there are multiple users who need rather
> infrequent access to the computer but often forget to log off. 


Relevant Pages

  • Re: Script works well, but not as scheduled tasks ?
    ... yourself a batch file like the one below then you would get the same error, regardless of you running it from the Command Prompt or as a scheduled task. ... I did your test with the Command Prompt and I had problem. ... There were lots of opened windows and I had windows which display this message: "L'application n'a pas reussi a s'initialiser correctement. ... my server is Win2000 server which has no "shutdown" command natively. ...
    (microsoft.public.scripting.vbscript)
  • Re: Username & Password as parameters
    ... authentication is being used on the server side to identify the caller, ... you need to impersonate that caller. ... scheduled task to run under the username/password you want to impersonate. ... k> Windows scheduled task. ...
    (microsoft.public.dotnet.languages.csharp)
  • Re: Scheduled Task for anyone who logs on
    ... Rundll32 into your Windows Script Host or command-shell scripts to log ... shutdown, power off and restart your computer. ... you could use the same scheduled task ...
    (microsoft.public.windowsxp.general)
  • Re: XP User Accounts - Scheduled tasks
    ... Troubleshooting Windows XP ... >> Accounts: Limit local account use of blank passwords to console logon ... Run Scheduled Task without a Password ...
    (microsoft.public.windowsxp.general)
  • Re: RPC Server unavailable
    ... Troubleshooting Windows XP ... Failed to create the scheduled task ... "The RPC server is unavailable.". ... > from Acronis but they are unable to find a solution. ...
    (microsoft.public.windowsxp.general)