Make windows honor my setting to do nothing when I close the lid of my computer

The issue is that the setting in the control panel is not changing the attribute in the registry. This could be due to a group policy, a third party power management tool, or a windows bug.

  1. run the following command in a cmd prompt to see what power settings are being honored by your system: PowerCfg /q
  2. Find the GUID setting for closing your lid. For me its

    Subgroup GUID: 4f971e89-eebd-4455-a8de-9e59040e7347
    Power Setting GUID: 5ca83367-6e45-459f-a27b-476b1d01c936 enter image description here Notice the current setting is 1. That means it will sleep when the lid is closed.

  3. Open regedit. (You can search for it in the start menu)
  4. Go to the following entry: Computer\HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Power\PowerSettings\4f971e89-eebd-4455-a8de-9e59040e7347\5ca83367-6e45-459f-a27b-476b1d01c936
  5. Change the Attributes Key to have a DWORD value of 0
  6. If you want to change the other power profiles you can go into the DefaultPowerSchemeValues subfolder and change those Attributes values to be 0 as well

The answer above is technically correct, however, I found an additional thing I had to do to actually stop my laptop from entering sleep mode.

I had previously selected the Performance power plan, but recently discovered there were a few options not being honored. So just on a whim, I thought I would try setting my laptop back to the Balanced power plan and adjsuting its settings to suit my needs. Lo and behold the settings all of a sudden all started being honored. I also noted that the previously selected Performance power plan disappeared from my list of power plan options. So it would appear one of the recent Windows Updates has potentially removed the Performance power plan from the default list of options, and I assume therefore only offering partial backwards compatibility.

Hope this helps anybody still struggling with this annoying behavioural glitch.