General Sleep Computer in Windows 11


Sleep_computer_banner.webp

This tutorial will show you different ways on how to put your Windows 11 computer to sleep.

Sleep uses very little power, your PC starts up faster, and you’re instantly back to where you left off. You don’t have to worry that you'll lose your work because of your battery draining because Windows automatically saves all your work and turns off the PC if the battery is too low. Use Sleep when you’re going to be away from your PC for just a little while.

On most PCs, you can resume from sleep by pressing your PC's power button. However, not all PCs are the same. You might be able to wake it by pressing any key on the keyboard, clicking a mouse button, or opening the lid on a laptop. Check the documentation that came with your computer or go to the manufacturer's website.


Contents





Option One

Sleep Computer by Closing Lid


This option is only available for laptops with a lid to close.

This option requires you to set the default lid close action to Sleep.


1 Close the laptop lid to perform the default lid close action.




Option Two

Sleep Computer by Keyboard


This requires you to set the default sleep button action to Sleep.


1 Press the Sleep button (if available) on your keyboard. (see screenshot below)

Sleep_button.jpg





Option Three

Sleep Computer by Pressing Power Button


This requires you to set the default power button action to Sleep.


1 Press the Power button on your device. (see screenshots below)

power-button-laptop.jpg
power-button-case.jpg





Option Four

Sleep Computer from Start menu


1 Open the Start menu :win:. (see screenshot below)

2 Click/tap on the Power button.

3 Click/tap on Sleep in the Power menu.

Sleep_Start_menu.jpg





Option Five

Sleep Computer from Win+X Quick Link Menu


1 Perform one of the following actions: (see screenshot below)
  • Press the Win + X keys, press the U key, and press the S key.
  • Open the Win+X Quick Link menu, click/tap on Shut down or sign out, and click/tap on Sleep.
Sleep_Win+X.jpg





Option Six

Sleep Computer from Alt+F4 Shut Down Windows Dialog


1 Click/tap on the desktop (Win+D) to make it the current focused (active) window.

2 Press the Alt + F4 keys.

This will only work if you did step 1. Otherwise, it will close the current active window instead of the desktop.


3 Select Sleep in the drop menu, and click/tap on OK or press Enter. (see screenshot below)

Sleep_Alt+F4.png





Option Seven

Sleep Computer from Ctrl+Alt+Del Screen


1 Press the Ctrl + Alt + Del keys.

2 Click/tap on the Power button.

3 Click/tap on Sleep in the Power menu.

Sleep_Ctrl+Alt+Del.jpg





Option Eight

Sleep Computer from Sign-in Screen


1 While on the Sign-in screen: (see screenshot below)

2 Click/tap on the Power button.

3 Click/tap on Sleep in the Power menu.

Sleep_sign-in.jpg





Option Nine

Sleep Computer using command


1 Open Windows Terminal, and select either Windows PowerShell or Command Prompt.

2 Copy and paste the appropriate command below into Windows Terminal, and press Enter.

Windows PowerShell
Add-Type -AssemblyName System.Windows.Forms; [System.Windows.Forms.Application]::SetSuspendState('Suspend', $false, $false)

OR

Command Prompt
powershell.exe -Command "& {Add-Type -Assembly System.Windows.Forms;[System.Windows.Forms.Application]::SetSuspendState('Suspend', $false, $false)}"


That's it,
Shawn Brink


 
Last edited:
I'm not sure how to apply that.
The method I use via AutoHotkey is in fact the same as making a shortcut on your desktop with:

%windir%\System32\rundll32.exe powrprof.dll,SetSuspendState

The only difference would be, that you would have to click that shortcut for setting the PC in sleep mode.

But while you have another setting in your BIOS (S0 in stead of S3, I dont know if that is functioning. I think it would, because in the past I used older computers where the modern standby was not there and I used the same command.

I used that on a programmable key on my Microsoft keyboard using the Microsoft Mouse and Keyboard Center app. But nowadays I have a keyboard from a different make, so that app does not function anymore.
 

My Computer

System One

  • OS
    Windows 11 Pro 23H2 22631.4890
    Computer type
    PC/Desktop
    Manufacturer/Model
    Build by vendor to my specs
    CPU
    AMD Ryzen 7 5700G
    Motherboard
    MSI PRO B550M-P Gen3
    Memory
    Kingston FURY Beast 2x16GB DIMM DDR4 2666 CL16
    Graphics Card(s)
    MSI GeForce GT 730 2GB LP V1
    Sound Card
    Creative Sound Blaster Audigy FX
    Monitor(s) Displays
    Samsung S24E450F 24"
    Screen Resolution
    1920 x 1080
    Hard Drives
    1. SSD Crucial P5 Plus 500GB PCIe M.2
    2. SSD-SATA Crucial MX500-2TB
    PSU
    Corsair CV650W
    Case
    Cooler Master Silencio S400
    Cooling
    Cooler Master Hyper H412R with Be Quiet Pure Wings 2 PWM BL038 fan
    Keyboard
    Cherry Stream (wired, scissor keys)
    Mouse
    Asus WT465 (wireless)
    Internet Speed
    70 Mbps down / 80 Mbps up
    Browser
    Firefox 130.0
    Antivirus
    F-secure via Internet provider
    Other Info
    Router: FRITZBox 7490
    Oracle VirtualBox 7 for testing software on Win 10 or 11
If on my system I switch off the electrical fuse (or the main switch where all my computer equipment has it's power from), that computer will not go into sleep. It will be switched off immediately and when switched on again, it will tell me that it has been shut down suddenly because of a power failure.

So for me your Option ten is no option at all!

If I would use a battery driven computer like a laptop (which I don't have) , that would indeed function, but it would be rediculous to do that. Every time I would like to set the computer to sleep the battery would be drained until almost empty, which is not good for the lifetime of that battery. While I am setting the computer into the sleep state several times a day, your method would soon ruin my system (if I would posess a laptop).

And if after 'sleep' by switching off the mains I would need the laptop without mains, it would not function, because the battery is empty.

So unless you posted your post as a joke, I don't see the use of it at all.
You're right. I'm working on my method. we need to consider the prison too. better call Saul!
 

My Computers

System One System Two

  • OS
    Windows 11 Pro 24H2
    Computer type
    Laptop
    Manufacturer/Model
    Huawei MateBook D15
    CPU
    Ryzen 5 3500U
    Memory
    8GB
    Graphics Card(s)
    Vega 8
    Screen Resolution
    FHD
    Hard Drives
    256GB Samsung SSD + 1TB HDD
    Browser
    Microsoft Edge
    Antivirus
    Microsoft Defender
  • Operating System
    Windows 10 Pro 22H2
    Computer type
    Laptop
    Manufacturer/Model
    MSI GS73 6RF Stealth Pro
    CPU
    intel core i7 6700HQ
    Memory
    16GB
    Graphics card(s)
    Nvidia Geforce GTX1060 (6GB)
    Screen Resolution
    FHD
    Hard Drives
    128GB SSD + 1TB HDD
    Browser
    Microsoft Edge
    Antivirus
    Windows Defender
I can invoke sleep by Win+X, followed by U and S.
 

My Computer

System One

  • OS
    Windows 11
    Computer type
    Laptop
    Manufacturer/Model
    HP Omen 17
I can invoke sleep by Win+X, followed by U and S.
In my system that functions as well.

Did you try to make a shortcut on your desktop with%windir%\System32\rundll32.exe powrprof.dll,SetSuspendState in it?
 

My Computer

System One

  • OS
    Windows 11 Pro 23H2 22631.4890
    Computer type
    PC/Desktop
    Manufacturer/Model
    Build by vendor to my specs
    CPU
    AMD Ryzen 7 5700G
    Motherboard
    MSI PRO B550M-P Gen3
    Memory
    Kingston FURY Beast 2x16GB DIMM DDR4 2666 CL16
    Graphics Card(s)
    MSI GeForce GT 730 2GB LP V1
    Sound Card
    Creative Sound Blaster Audigy FX
    Monitor(s) Displays
    Samsung S24E450F 24"
    Screen Resolution
    1920 x 1080
    Hard Drives
    1. SSD Crucial P5 Plus 500GB PCIe M.2
    2. SSD-SATA Crucial MX500-2TB
    PSU
    Corsair CV650W
    Case
    Cooler Master Silencio S400
    Cooling
    Cooler Master Hyper H412R with Be Quiet Pure Wings 2 PWM BL038 fan
    Keyboard
    Cherry Stream (wired, scissor keys)
    Mouse
    Asus WT465 (wireless)
    Internet Speed
    70 Mbps down / 80 Mbps up
    Browser
    Firefox 130.0
    Antivirus
    F-secure via Internet provider
    Other Info
    Router: FRITZBox 7490
    Oracle VirtualBox 7 for testing software on Win 10 or 11
Did you try to make a shortcut on your desktop with%windir%\System32\rundll32.exe powrprof.dll,SetSuspendState in it?
Yes, I did, but it didn't work on the new HP Omen laptop. (I also tried that in my old Windows 10 Acer, and the script that you suggested worked perfectly on that)
 

My Computer

System One

  • OS
    Windows 11
    Computer type
    Laptop
    Manufacturer/Model
    HP Omen 17
Yes, I did, but it didn't work on the new HP Omen laptop.
Could you try to set the value in the BIOS of that laptop to S3, like I showed in #17?
You certainly will have to use some other part of the settings of the BIOS, but 'Modern standby" or S3 should be somewhere.

I searched on the HP site if I could find some user manual for the BIOS options in the lapetop HP Omen 17, but failed.
No detailed instructions found.
 

My Computer

System One

  • OS
    Windows 11 Pro 23H2 22631.4890
    Computer type
    PC/Desktop
    Manufacturer/Model
    Build by vendor to my specs
    CPU
    AMD Ryzen 7 5700G
    Motherboard
    MSI PRO B550M-P Gen3
    Memory
    Kingston FURY Beast 2x16GB DIMM DDR4 2666 CL16
    Graphics Card(s)
    MSI GeForce GT 730 2GB LP V1
    Sound Card
    Creative Sound Blaster Audigy FX
    Monitor(s) Displays
    Samsung S24E450F 24"
    Screen Resolution
    1920 x 1080
    Hard Drives
    1. SSD Crucial P5 Plus 500GB PCIe M.2
    2. SSD-SATA Crucial MX500-2TB
    PSU
    Corsair CV650W
    Case
    Cooler Master Silencio S400
    Cooling
    Cooler Master Hyper H412R with Be Quiet Pure Wings 2 PWM BL038 fan
    Keyboard
    Cherry Stream (wired, scissor keys)
    Mouse
    Asus WT465 (wireless)
    Internet Speed
    70 Mbps down / 80 Mbps up
    Browser
    Firefox 130.0
    Antivirus
    F-secure via Internet provider
    Other Info
    Router: FRITZBox 7490
    Oracle VirtualBox 7 for testing software on Win 10 or 11
Could you try to set the value in the BIOS of that laptop to S3, like I showed in #17?
You certainly will have to use some other part of the settings of the BIOS, but 'Modern standby" or S3 should be somewhere.

I searched on the HP site if I could find some user manual for the BIOS options in the lapetop HP Omen 17, but failed.
No detailed instructions found.
Sorry, I should have mentioned that on seeing #17 I did check the BIOS, but the only sleep-related setting I could see was Wake on LAN (on the Configuration screen).

I too have been unable to find any instructions covering the BIOS settings, but the BIOS is seems fairly basic.
 

Attachments

  • HP Omen 17 BIOS - Main.webp
    HP Omen 17 BIOS - Main.webp
    151.5 KB · Views: 1
  • HP Omen 17 BIOS - Security.webp
    HP Omen 17 BIOS - Security.webp
    110.2 KB · Views: 1
  • HP Omen 17 BIOS - Configuration.webp
    HP Omen 17 BIOS - Configuration.webp
    109.9 KB · Views: 1
  • HP Omen 17 BIOS - Boot Options.webp
    HP Omen 17 BIOS - Boot Options.webp
    88.7 KB · Views: 1

My Computer

System One

  • OS
    Windows 11
    Computer type
    Laptop
    Manufacturer/Model
    HP Omen 17
Sorry, I should have mentioned that on seeing #17 I did check the BIOS, but the only sleep-related setting I could see was Wake on LAN (on the Configuration screen).
No problem at all!

I indeed don't see anything that's pointing onto S3. Though I know, my older PC only had no setting for the Modern standby at all and the command in #24 did work right away. So I don't see why it does not work on your laptop...
 

My Computer

System One

  • OS
    Windows 11 Pro 23H2 22631.4890
    Computer type
    PC/Desktop
    Manufacturer/Model
    Build by vendor to my specs
    CPU
    AMD Ryzen 7 5700G
    Motherboard
    MSI PRO B550M-P Gen3
    Memory
    Kingston FURY Beast 2x16GB DIMM DDR4 2666 CL16
    Graphics Card(s)
    MSI GeForce GT 730 2GB LP V1
    Sound Card
    Creative Sound Blaster Audigy FX
    Monitor(s) Displays
    Samsung S24E450F 24"
    Screen Resolution
    1920 x 1080
    Hard Drives
    1. SSD Crucial P5 Plus 500GB PCIe M.2
    2. SSD-SATA Crucial MX500-2TB
    PSU
    Corsair CV650W
    Case
    Cooler Master Silencio S400
    Cooling
    Cooler Master Hyper H412R with Be Quiet Pure Wings 2 PWM BL038 fan
    Keyboard
    Cherry Stream (wired, scissor keys)
    Mouse
    Asus WT465 (wireless)
    Internet Speed
    70 Mbps down / 80 Mbps up
    Browser
    Firefox 130.0
    Antivirus
    F-secure via Internet provider
    Other Info
    Router: FRITZBox 7490
    Oracle VirtualBox 7 for testing software on Win 10 or 11
I would like to be able to put my PC to sleep using a command, but option 9 results in the computer going into hibernation (as do HDMI's variants). On the other hand, options 4 to 8 do put the computer to sleep, and not into hibernation.
From a command prompt or in the Run dialog (Win + R) or in the Target field of a desktop shortcut, you can:
"%windir%\System32\WindowsPowerShell\v1.0\powershell.exe" -NoProfile -ExecutionPolicy Bypass -Command Add-Type -Assembly System.Windows.Forms;[System.Windows.Forms.Application]::SetSuspendState('Suspend',$false,$false)
  • Specifying the filepath to powershell.exe ensures that the command works with the default PowerShell 5.1 even if PowerShell Core has been installed on the computer. This could help to avoid getting the kind of PowerShell errors that you are experiencing.
  • Additionally, by adding -NoProfile and -ExecutionPolicy Bypass to the list of parameters we can ensure that any settings in PowerShell profiles and the PowerShell execution policies are ignored.
  • No admin rights are required to run this specific PowerShell command.
  • To put the computer in Hibernation instead of Sleep, you can simply substitute 'Suspend' with 'Hibernate' in the command.
  • On computers that support Modern Standby, putting the computer to Sleep doesn't work like this; you have to use a completely different method to achieve this specific goal (e.g., this method).
 

My Computers

System One System Two

  • OS
    11 Home
    Computer type
    Laptop
    Manufacturer/Model
    Asus TUF Gaming F16 (2024)
    CPU
    i7 13650HX
    Memory
    16GB DDR5
    Graphics Card(s)
    GeForce RTX 4060 Mobile
    Sound Card
    Eastern Electric MiniMax DAC Supreme; Emotiva UMC-200; Astell & Kern AK240
    Monitor(s) Displays
    Sony Bravia XR-55X90J
    Screen Resolution
    3840×2160
    Hard Drives
    512GB SSD internal
    37TB external
    PSU
    Li-ion
    Cooling
    2× Arc Flow Fans, 4× exhaust vents, 5× heatpipes
    Keyboard
    Logitech K800
    Mouse
    Logitech G402
    Internet Speed
    20Mbit/s up, 250Mbit/s down
    Browser
    FF
  • Operating System
    11 Home
    Computer type
    Laptop
    Manufacturer/Model
    Medion S15450
    CPU
    i5 1135G7
    Memory
    16GB DDR4
    Graphics card(s)
    Intel Iris Xe
    Sound Card
    Eastern Electric MiniMax DAC Supreme; Emotiva UMC-200; Astell & Kern AK240
    Monitor(s) Displays
    Sony Bravia XR-55X90J
    Screen Resolution
    3840×2160
    Hard Drives
    2TB SSD internal
    37TB external
    PSU
    Li-ion
    Mouse
    Logitech G402
    Keyboard
    Logitech K800
    Internet Speed
    20Mbit/s up, 250Mbit/s down
    Browser
    FF
From a command prompt or in the Run dialog (Win + R) or in the Target field of a desktop shortcut, you can:
"%windir%\System32\WindowsPowerShell\v1.0\powershell.exe" -NoProfile -ExecutionPolicy Bypass -Command Add-Type -Assembly System.Windows.Forms;[System.Windows.Forms.Application]::SetSuspendState('Suspend',$false,$false)
Many thanks for the detailed posting, hdmi. Sadly, even this suggestion fails to put the laptop into sleep state.
 

My Computer

System One

  • OS
    Windows 11
    Computer type
    Laptop
    Manufacturer/Model
    HP Omen 17
Many thanks for the detailed posting, hdmi. Sadly, even this suggestion fails to put the laptop into sleep state.
  • On computers that support Modern Standby, putting the computer to Sleep doesn't work like this; you have to use a completely different method to achieve this specific goal (e.g., this method).
 

My Computers

System One System Two

  • OS
    11 Home
    Computer type
    Laptop
    Manufacturer/Model
    Asus TUF Gaming F16 (2024)
    CPU
    i7 13650HX
    Memory
    16GB DDR5
    Graphics Card(s)
    GeForce RTX 4060 Mobile
    Sound Card
    Eastern Electric MiniMax DAC Supreme; Emotiva UMC-200; Astell & Kern AK240
    Monitor(s) Displays
    Sony Bravia XR-55X90J
    Screen Resolution
    3840×2160
    Hard Drives
    512GB SSD internal
    37TB external
    PSU
    Li-ion
    Cooling
    2× Arc Flow Fans, 4× exhaust vents, 5× heatpipes
    Keyboard
    Logitech K800
    Mouse
    Logitech G402
    Internet Speed
    20Mbit/s up, 250Mbit/s down
    Browser
    FF
  • Operating System
    11 Home
    Computer type
    Laptop
    Manufacturer/Model
    Medion S15450
    CPU
    i5 1135G7
    Memory
    16GB DDR4
    Graphics card(s)
    Intel Iris Xe
    Sound Card
    Eastern Electric MiniMax DAC Supreme; Emotiva UMC-200; Astell & Kern AK240
    Monitor(s) Displays
    Sony Bravia XR-55X90J
    Screen Resolution
    3840×2160
    Hard Drives
    2TB SSD internal
    37TB external
    PSU
    Li-ion
    Mouse
    Logitech G402
    Keyboard
    Logitech K800
    Internet Speed
    20Mbit/s up, 250Mbit/s down
    Browser
    FF
Many thanks for the detailed posting, hdmi. Sadly, even this suggestion fails to put the laptop into sleep state.
try this app (test to see if it puts your pc to sleep). you need to

1) disable Windows Power Plan screen off/sleep

OR

2) set windows power plan settings to a longer time than autooff is set to (so autooff takes effect first)

.https://www.oldergeeks.com/downloads/file.php?id=3210
 

My Computer

System One

  • OS
    Windows 11 Pro
Many thanks for the detailed posting, hdmi. Sadly, even this suggestion fails to put the laptop into sleep state.
  • On computers that support Modern Standby, putting the computer to Sleep doesn't work like this; you have to use a completely different method to achieve this specific goal (e.g., this method).
I can be over-thorough, and tried both methods just in case.
 

My Computer

System One

  • OS
    Windows 11
    Computer type
    Laptop
    Manufacturer/Model
    HP Omen 17
try this app (test to see if it puts your pc to sleep). you need to

1) disable Windows Power Plan screen off/sleep

OR

2) set windows power plan settings to a longer time than autooff is set to (so autooff takes effect first)

.https://www.oldergeeks.com/downloads/file.php?id=3210
Many thanks for the suggestion. I've downloaded and installed the app, but it doesn't appear to deal with sleep. The actions that the app can trigger are:
Shut down Windows
Restart Windows
Turn off the display
Turn on the display
Lock Windows
Show an alarm message
Run a program
Terminate a program
Rerun a program
 

My Computer

System One

  • OS
    Windows 11
    Computer type
    Laptop
    Manufacturer/Model
    HP Omen 17
Many thanks for the suggestion. I've downloaded and installed the app, but it doesn't appear to deal with sleep. The actions that the app can trigger are:
Shut down Windows
Restart Windows
Turn off the display
Turn on the display
Lock Windows
Show an alarm message
Run a program
Terminate a program
Rerun a program
thats very odd. it has this option on every pc i've tested it on:

1740248072134.webp
 

My Computer

System One

  • OS
    Windows 11 Pro
I have been thinking about why your laptop might have been set by the manufacturer (if he did indeed) not to use sleep.
And came to the conclusion that for most laptops the pure 'sleep' (modern standby) function is a rather unwanted thing. Because the laptop will not be switched off, but put in a situation where many parts of the motherboard still will be functioning and so will be drawing current, draining the battery.

Of course this would not be any problem when you allways have the laptop on mains supply!

Then I went searching for some way to set a registryvalue to block that modern standby and found this tutorial:

If the modern standby would have been disabled, there would be a registry value like this one:
[HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Power]
"PlatformAoAcOverride"=dword:00000000

If that entry is there, you only would have to delete it or use the registryfile in the tutorial "Enable_Modern_Standby.reg".

Of course it is not sure that exactly this registry entry was used to disable sleep, but you could have a look for this one.

I myself have disabled the lock command in all available menus by such a registry-edit.
Found that as well in one of the tutorials. Thanks to @Brink (y)

Edit: just read in other Internet topics that modern standby would be exactly the opposite from what I supposed. So the S0 situation would be modern standby, while S3 is the classic one. In that case you might try the opposite way: disable modern standby and look if that would help.

I am not sure at all that the issue I found will matter at all, but it is an attempt to help.

It is very practical to look in the registry before you do any changes at all at HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Power
and look if the value PlatformAoAcOverride is there , if yes , what it's value is.
 
Last edited:

My Computer

System One

  • OS
    Windows 11 Pro 23H2 22631.4890
    Computer type
    PC/Desktop
    Manufacturer/Model
    Build by vendor to my specs
    CPU
    AMD Ryzen 7 5700G
    Motherboard
    MSI PRO B550M-P Gen3
    Memory
    Kingston FURY Beast 2x16GB DIMM DDR4 2666 CL16
    Graphics Card(s)
    MSI GeForce GT 730 2GB LP V1
    Sound Card
    Creative Sound Blaster Audigy FX
    Monitor(s) Displays
    Samsung S24E450F 24"
    Screen Resolution
    1920 x 1080
    Hard Drives
    1. SSD Crucial P5 Plus 500GB PCIe M.2
    2. SSD-SATA Crucial MX500-2TB
    PSU
    Corsair CV650W
    Case
    Cooler Master Silencio S400
    Cooling
    Cooler Master Hyper H412R with Be Quiet Pure Wings 2 PWM BL038 fan
    Keyboard
    Cherry Stream (wired, scissor keys)
    Mouse
    Asus WT465 (wireless)
    Internet Speed
    70 Mbps down / 80 Mbps up
    Browser
    Firefox 130.0
    Antivirus
    F-secure via Internet provider
    Other Info
    Router: FRITZBox 7490
    Oracle VirtualBox 7 for testing software on Win 10 or 11
I can invoke sleep by Win+X, followed by U and S.
here, its not a permanent solution, but until we can track down exactly why you dont have many options for Sleep... use this autohotkey script (i've attached the .exe if you want for ease. it will invoke those keystrokes so you can pin to taskbar, etc to click to sleep

ahk code:
Code:
Send, #x
sleep, 100
Send, U
Sleep, 100  
Send, S

Yes, it is strange. Two of the options (including putting the computer to sleep) are missing from the installation on my laptop).
View attachment 126172
Go to device manager and make sure your display adapter and chipset drivers are correct.
 

Attachments

My Computer

System One

  • OS
    Windows 11 Pro
This version should work on every Windows 10/11 computer that either supports Standby (S3) aka "Sleep" or supports Standby (S0 Low Power Idle) aka "Modern Standby".

"%windir%\System32\WindowsPowerShell\v1.0\powershell.exe" -NoProfile -ExecutionPolicy Bypass -Command "Add-Type -TypeDefinition 'using System; using System.Runtime.InteropServices; public static class User32 { [DllImport(\"user32.dll\", SetLastError = true)] public static extern int SendMessage(int hWnd, int hMsg, int wParam, int lParam); }' -ReferencedAssemblies System.Windows.Forms; $lines = (powercfg /a) -split \"`r`n\"; $cont = $true; foreach ($line in $lines) { if ($cont) { if ($line -eq 'The following sleep states are available on this system:') { $cont = $false } else { continue } } elseif ($line -eq ' Standby (S3)') { [System.Windows.Forms.Application]::SetSuspendState('Suspend', $false, $false); break } elseif ($line -eq ' Standby (S0 Low Power Idle)') { Start-Sleep -Seconds 2; $null = [User32]::SendMessage((New-Object System.Windows.Forms.Form).Handle.ToInt32(), 0x0112, 0xF170, 2); break } elseif ($line -eq 'The following sleep states are not available on this system:') { break } }"
 

My Computers

System One System Two

  • OS
    11 Home
    Computer type
    Laptop
    Manufacturer/Model
    Asus TUF Gaming F16 (2024)
    CPU
    i7 13650HX
    Memory
    16GB DDR5
    Graphics Card(s)
    GeForce RTX 4060 Mobile
    Sound Card
    Eastern Electric MiniMax DAC Supreme; Emotiva UMC-200; Astell & Kern AK240
    Monitor(s) Displays
    Sony Bravia XR-55X90J
    Screen Resolution
    3840×2160
    Hard Drives
    512GB SSD internal
    37TB external
    PSU
    Li-ion
    Cooling
    2× Arc Flow Fans, 4× exhaust vents, 5× heatpipes
    Keyboard
    Logitech K800
    Mouse
    Logitech G402
    Internet Speed
    20Mbit/s up, 250Mbit/s down
    Browser
    FF
  • Operating System
    11 Home
    Computer type
    Laptop
    Manufacturer/Model
    Medion S15450
    CPU
    i5 1135G7
    Memory
    16GB DDR4
    Graphics card(s)
    Intel Iris Xe
    Sound Card
    Eastern Electric MiniMax DAC Supreme; Emotiva UMC-200; Astell & Kern AK240
    Monitor(s) Displays
    Sony Bravia XR-55X90J
    Screen Resolution
    3840×2160
    Hard Drives
    2TB SSD internal
    37TB external
    PSU
    Li-ion
    Mouse
    Logitech G402
    Keyboard
    Logitech K800
    Internet Speed
    20Mbit/s up, 250Mbit/s down
    Browser
    FF
This version should work on every Windows 10/11 computer that either supports Standby (S3) aka "Sleep" or supports Standby (S0 Low Power Idle) aka "Modern Standby".
I really do appreciate the time that you have spent on this, but I'm sorry to say that my PC is not responding even to this instruction.

Go to device manager and make sure your display adapter and chipset drivers are correct.
As you suggested, I have re-checked the drivers, and they don't appear to be a problem.

ahk code:
Send, #x sleep, 100 Send, U Sleep, 100 Send, S
This works well! I have used the .exe version that you kindly provided, and have assigned it in the registry to the HP Omen's special keyboard key (intended to be used for a calculator, which I don't need). The laptop now immediately goes to sleep when this key is pressed, and immediately re-awakes when the power key is pressed. I'm very pleased with this solution.

Thank you, dacrone, for this solution. And thank you, also, Brink, Kees, hdmi, and Dronix for your contributions.
 

My Computer

System One

  • OS
    Windows 11
    Computer type
    Laptop
    Manufacturer/Model
    HP Omen 17

Latest Support Threads

Back
Top Bottom