This project has moved. For the latest updates, please go here.

Windows allows for one of several actions to be taken when the lid is closed on a laptop: Sleep, Hibernate, or Shut Down. While shutting down will cause the user to be logged off, there is no option to log off and then sleep or hibernate (or to just log off with no following change to the power state).

Session Arbiter can be configured to achieve this behaviour, which is useful in some environments, particularly with loan pool laptops where users may forget to log off when returning a laptop to storage, or will begin logging off but then close the lid before the laptop finishes logging off. This can cause the user’s roaming profile to not be saved, and on Windows 7, can cause an issue where subsequent users may encounter an error message and be unable to log on.

Requirements

This feature requires Windows Vista and or later. The ability to detect a lid close is not available to programs running on earlier version of Windows (only the OS can detect it), so configuring these options will do nothing on earlier versions.

Configuration Options

Disable the built-in lid switch action

First, you will need to disable any built-in action that Windows is configured to take when the lid is closed.  You can do this via Power Options in the Control Panel (look for the setting Change what the power buttons do) or by Group Policy:

Computer Configuration\Policies\Administrative Templates\System\Power Management\Button Settings

  • Select the Lid Switch Action (On Battery)
  • Select the Lid Switch Action (Plugged In)

Set this to Do Nothing for both the On Battery and Plugged In options.

Set the logoff action

You can configure this as either a computer-level or user-level setting by creating a registry key at one of the following locations:

  • HKEY_LOCAL_MACHINE\Software\Policies\SessionArbiter
    DWORD: LogoffOnLidClose
  • HKEY_CURRENT_USER\Software\Policies\SessionArbiter
    DWORD: LogoffOnLidClose

Set this value to one of the following (which match the normal Group Policy values):

Value Behaviour Details
0 Not configured The user will not be logged off when the lid is closed (default).
1 Enabled The user will be logged off when the lid is closed.
2 Disabled Setting this value in either the machine or user registry will prevent the user from being logged off, even if a value of 1 is set in the other part of the registry.

Selecting the action to take after the user has logged off

You can configure this as either a computer-level or user-level setting by creating a registry key at one of the following locations:

  • HKEY_LOCAL_MACHINE\Software\Policies\SessionArbiter
  • HKEY_CURRENT_USER\Software\Policies\SessionArbiter

Create one or more of the following settings as DWORD type values:

Registry Value Details
SuspendOnGinaLidClose Specify 1 to have the computer enter Sleep once the logoff has completed, or 2 to have the computer enter Hibernate. Default: No action.

If this is configured in multiple places (e.g at machine and user level, or for multiple users that get logged off at once), the most low-power suspend state will be used (Hibernate being the lowest).
WaitBeforeSuspend Specify the number of milliseconds to wait after the logoff completes before executing the above action. Default: 2000ms (2 seconds)

You must specify a value of at least 1ms. If it is set to 0, it will be ignored and the above default used. It is not recommended to use a value less than the default, as during testing, some laptops would enter suspend so quickly after the logoff completed that Windows exhibited errors as if the logoff had not actually finished.

If this is configured in multiple places (e.g at machine and user level, or for multiple users that get logged off at once), the longest wait time will be used.

Note: If the lid is re-opened after the logoff begins, but before the suspend action is executed (either because the session has not finished logging off, or the wait period has not expired), the suspend action will be cancelled.

Known Issues

  • Because the built-in lid close action is disabled (in order to allow the log off event to finish without the computer entering sleep part-way through), the built-in action to wake the computer when the lid is opened will not function. You must use the power button to power the laptop back on.

Last edited Nov 5, 2012 at 9:45 PM by jschlackman, version 7