Putting a Windows 10/11 computer to sleep over the network using SSH.


Recommended Posts

So I have a little Lenovo computer I got off eBay for the sole purpose of displaying my security cameras above my TV. It's a Pentium with 4GB of ram and uses around 11 watts. But I don't need it awake and running at night when I'm sleeping or out of the house.

I was looking for a way to put it to sleep remotely because there is no mouse and keyboard hooked up to it. I found a way to do it via SSH. Install OpenSSH on the computer, install putty on my computer, and create a batch file which when ran, connects to the SSH server using putty and sends the following sleep command.

 RUNDLL32.EXE powrprof.dll,SetSuspendState

The Bat file looks like this

putty.exe -ssh owner@IP address -pw Password -m c:\command.txt

You replace the ip address with the ip address of the computer and the password with the password of the computer. Then just put the rundll command above in the command.txt.

Then to wake it up I simply use a wake-on Lan app. I was surprised how well it worked on my first attempt, which can be seen in the video below.

11 watts isn't much, but a little here and a little there and it adds up.

  • +Warwagon changed the title to Putting a Windows 10/11 computer to sleep over the network using SSH.
  On 09/02/2023 at 16:08, Warwagon said:

11 watts isn't much, but a little here and a little there and it adds up.

Expand  

Yeah to the tune of what about 65 cents a month, if you leave it off for 16 hours a day and elec costs you like 12 (national average or so) cents a kwh.. So what 8$ in a year - you could buy yourself a starbucks coffee ;) heheh

But its not fully off is it, so are you really saving the whole 11 watts or is it something less than that your saving? ;) I am all for saving electric and all - but is the say 2 cents a day worth it if something fails and it doesn't come back up when you want to see whats on the camera? ;)

  On 09/02/2023 at 20:05, BudMan said:

Yeah to the tune of what about 65 cents a month, if you leave it off for 16 hours a day and elec costs you like 12 (national average or so) cents a kwh.. So what 8$ in a year - you could buy yourself a starbucks coffee ;) heheh

But its not fully off is it, so are you really saving the whole 11 watts or is it something less than that your saving? ;) I am all for saving electric and all -

Expand  

I'm just a tightwad who also hates wasting electricity.  Also my elec cost is 8 cents for the first 1,000 kw then it goes down to 4 cents. At least during the winter.

So, get this, I just put all 4 of my couch computer monitors on a surge protector connected to a voice-controlled outlet. So at night, I say "Ok, Google, turn off the monitors" and the combined sleep of all 4 monitors which was 3 watts, is now 0 :) (I put a kill-a-watt on it)

But I can also tell them to turn off when i'm down stairs in my office, not even on the couch computer. In that case it saves 180 watts

So now we are up to about 13 watts! woot! (little computer is probably burning 1 watt just to sleep.

As per the last bit, the computer gets turned on when I wake up in the morning and get turned off when I go to bed.

  • Like 1
  • Love 1
  On 09/02/2023 at 20:26, BudMan said:

4 cents per kwh?  JFC that is cheap.. So your saving what like $2.5 a year.. Not even enough for a coffee ;)

Expand  

 

  On 09/02/2023 at 20:26, BudMan said:

4 cents per kwh?  JFC that is cheap.. So your saving what like $2.5 a year.. Not even enough for a coffee ;)

Expand  

Its enough for a Tim Hortons coffee... lol

  • Haha 1
  On 09/02/2023 at 23:18, Matthew S. said:

Its enough for a Tim Hortons coffee... lol

Expand  

I think that's almost enough for Dunkin' if I remember right..

I would be more interested in this 4 cents you say your paying, or even 8 cents .  So if you go over 1000 kwh for the month the rate drops to 4 cents?  That is some cheap power to be sure, prob not much solar in your area at those rates.

Do they hit you with high delivery charges?  This is what can be confusing in finding true cost of power in some areas - where sites will list the cost per kwh, they don't always show the delivery charges..

Here in chicagoland the price per kwh is only like 9 some cents.. But then they add on another like 4 cents for delivery of that electric per kwh.  And then there is just the charge for being a customer, and the meter charge..

Hope my jokey way of responding didn't come across that not worth saving some kwh here or there.. But there is prob some bigger fish to fry in saving electric than something that only uses like 10 watts..  And shutting it down for a few hours a day.

How long do you leave it off vs on is needed to know how much actual kwh you might be saving as well.

 

 

 

 

 

  On 11/02/2023 at 05:36, BudMan said:

I would be more interested in this 4 cents you say your paying, or even 8 cents .  So if you go over 1000 kwh for the month the rate drops to 4 cents?  That is some cheap power to be sure, prob not much solar in your area at those rates.

Do they hit you with high delivery charges?  This is what can be confusing in finding true cost of power in some areas - where sites will list the cost per kwh, they don't always show the delivery charges..

Here in chicagoland the price per kwh is only like 9 some cents.. But then they add on another like 4 cents for delivery of that electric per kwh.  And then there is just the charge for being a customer, and the meter charge..

How long do you leave it off vs on is needed to know how much actual kwh you might be saving as well.

Expand  

image.png.10f1aee4aa2553f68a37b2a526686f68.png

I forgot, that there is also the Energy Adjustment Clause, where they adjust what the have to pay. I have no gas and just have heat pump. Usually during months were the heat or ac doesn't have to run my electric bill is about $60.

  Quote

Hope my jokey way of responding didn't come across that not worth saving some kwh here or there.. But there is prob some bigger fish to fry in saving electric than something that only uses like 10 watts..  And shutting it down for a few hours a day.

Expand  

For sure, I've done best I could, even replacing computers with lower power ones that do the same thing.

But then I go and build a new computer more power hungry than the last one. But if ya want performance gotta use some power.

  On 10/02/2023 at 17:32, Warwagon said:

Do tell.

Expand  

It's funny, I just finished watching this video and then I saw this thread. There are some neat tips throughout the video, but he talks specifically about shutting down remote computers at 14:43:

 

you used 2782 Kwh in 1 month?  WTF dude..  That is insane.. I have never used that much even in the summer with the AC running like constantly since the wife likes it 67 degrees..

Here is old bill showing before went solar

beforesolar.jpg.dab08157af3ba7b1c4107e6c832b677e.jpg

You used like what I used in 2 months in summer with AC going full bore..

 

 

  On 11/02/2023 at 22:58, BudMan said:

you used 2782 Kwh in 1 month?  WTF dude..  That is insane.. I have never used that much even in the summer with the AC running like constantly since the wife likes it 67 degrees..

Here is old bill showing before went solar

beforesolar.jpg.dab08157af3ba7b1c4107e6c832b677e.jpg

You used like what I used in 2 months in summer with AC going full bore..

 

 

Expand  

Air conditioning is much cheaper than heat pump in the winter. We had a Lowe’s in the -20. . At that point the emergency heat kicks on and I’m using electric heat. Actually under 15° needs assistant from the emergency heat.

  On 11/02/2023 at 23:01, Warwagon said:

and I’m using electric heat.

Expand  

Ugghhh.. Yeah that would suck.. Good thing your rate over 1k is only 4 cents ;)

  On 09/02/2023 at 16:08, Warwagon said:
RUNDLL32.EXE powrprof.dll,SetSuspendState 0,1,0
Expand  

Please stop spreading incorrect information. Your 0,1,0 parameters here do nothing! It is undefined if this command will sleep or hibernate. You are lucky it does not just crash and burn.

 

  Quote
Expand  

See also:

Shutdown.exe on recent versions can hibernate but not sleep for unknown reasons. Use Powershell instead for sleep.

Edited by WndSks
  On 12/02/2023 at 22:04, WndSks said:

Please stop spreading bad information. Your 0,1,0 parameters here do nothing! It is undefined if this command will sleep or hibernate. You are lucky it does not just crash and burn.

 

See also:

Expand  

I can confirm the 0,1,0 are not needed. I found that command online from numinous sources, so I didn't think to modify it, but I did remove those numbers from the command and it still works. Removed the numbers from the command on the first post.

  On 12/02/2023 at 22:19, Warwagon said:

and it still works

Expand  

but it is still incorrect and the result is undefined. There is simply no way to correctly call this function with rundll32. You must p/invoke with powershell.

 

Something along the lines of

Add-Type -Assembly System.Windows.Forms
[System.Windows.Forms.Application]::SetSuspendState([System.Windows.Forms.PowerState]::Suspend, $true, $false)

(I did not test this but it should be close)

  On 13/02/2023 at 01:00, farmeunit said:

Why don't you just schedule it?

Expand  

Because I don't always go to bed at the same time. I also want to put it to sleep if I leave the house for the day.

It doesn't have to be an exact schedule.  Just set to midnight if you go between 10-midnight.  As for leaving the house, use IFTT.  Set up something on your phone like a geofence.  You could probably even tie it into Alexa, so when you say Goodnight, it turns it off.  And when you say something else it turns it on.  Of course that requires WoL or something like that.  Lots of ways to really do it, but you need to right combination or hardware.

Honestly, use a smart plug.  Problem solved.

  On 18/02/2023 at 23:52, farmeunit said:

It doesn't have to be an exact schedule.  Just set to midnight if you go between 10-midnight.  As for leaving the house, use IFTT.  Set up something on your phone like a geofence.  You could probably even tie it into Alexa, so when you say Goodnight, it turns it off.  And when you say something else it turns it on.  Of course that requires WoL or something like that.  Lots of ways to really do it, but you need to right combination or hardware.

Honestly, use a smart plug.  Problem solved.

Expand  

Smart plug is like yanking the power out of the wall while it's running. Honestly I'm really happy with this setup. It works perfect for what I need.

If you're just using it for viewing cameras and such, it doesn't really matter.  Especially with mostly solid state parts.  The only time it really matters if it's writing data because it could get corrupted.  Otherwise, it makes little to no difference.  That being said, you can automated the whole process before actually shutting off the plug.  Then you can have it return to the last power state once the plug is turned on.  I was just giving you options instead of focusing on one way to do it.

 

Home Assistant or several other options available.

  On 20/02/2023 at 20:45, farmeunit said:

If you're just using it for viewing cameras and such, it doesn't really matter.  Especially with mostly solid state parts.  The only time it really matters if it's writing data because it could get corrupted.  Otherwise, it makes little to no difference.  That being said, you can automated the whole process before actually shutting off the plug.  Then you can have it return to the last power state once the plug is turned on.  I was just giving you options instead of focusing on one way to do it.

Expand  

Ya, I could have the computer shut down at X time, and then set it so a smart outlet turn off. Or I can just double click a batch file 3 seconds before I get off the couch and go to bed.

I do shut the machine off when I leave for 3 or 4 days.

Thanks for the options though.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
  • Posts

    • No operating system works well with programs that modify its interface. There will always be bugs, whether it's MacOS or Linux. Windows too, you'll only suffer from bugs using this crap software.
    • KDE brings UI improvements, bug fixes and more to Plasma 6.4 as stable release draws near by David Uzondu With less than a month to the release of Plasma 6.4, the KDE dev team has shared what it has been working on in the latest issue of its weekly roundup. The update shows a heavy focus on user interface polish and a whole slew of bug fixes as the June 17 release date gets closer. The team has pushed a number of UI refinements for the upcoming version. On the System Settings page for Wi-Fi, the network list can now be fully navigated with a keyboard. KDE also disabled the ability to drag and drop displays on top of one another in the monitor settings. This was done because it could create unsupported arrangements that triggered a cascade of strange bugs throughout the system. Waking up a sleeping computer by pressing the power button no longer causes the bizarre logout screen to appear after you unlock it, which is a relief. Alignment issues in the settings page for the Digital Clock widget were also resolved. The list of bug fixes for 6.4 is extensive. The development team has fixed the most common crash affecting the System Monitor and squashed another one related to a divide-by-zero error. For users with multiple monitors, a long-awaited fix has landed that prevents windows from disappearing when the screen they are on gets disconnected. Even the humble Sticky Notes widget received attention; it will no longer freeze the Plasma shell if you place it on a very thick panel. Discover, the software center, also had a bug patched that caused it to crash if closed too quickly after launch. Here's the full list of improvements: Putting a Sticky Note widget on a very thick panel can no longer cause Plasma to freeze; now, you can use a thick panel with a sticky note on it as a notes sidebar. Fixed the most common System Monitor crash. Fixed another crash in System Monitor, this time a divide-by-zero. Fixed a case where xdg-desktop-portal-kde could crash after you choose a video source to start streaming. Fixed a bug that caused Discover to crash if you close it immediately after it launched. Fixed multiple subtle bugs with the screen chooser widget and OSD that caused it to do the wrong thing on rotated screens or when mirroring screens. Fixed a bug that caused the System Settings’ search field not to be focused properly when pressing Ctrl+F while any UI elements in a settings page already had focus. Fixed the root cause of multiple issues involving windows disappearing when you disconnect the screen they’re on. Clicking a button on a desktop widget that opens a menu no longer inappropriately makes the widget enter Widget Edit Mode. Files with a # or ? character in their name or full path are no longer unexpectedly missing from the history lists in Kicker/Kickoff/etc launchers. Fixed a bug that caused the screen chooser window to sometimes not appear as expected when OBS was launched. Fixed a bug that caused tiled windows on a multi-screen setup to lose their tiling settings when the system went to sleep and woke up again. The "Move window to [activity]" feature now works properly when invoked from the Task Manager widget. Fixed a bug in the Kicker Application Menu that caused keyboard navigation not to work if the popup opened with an item under the pointer. In the Overview effect’s grid view, dragging windows tiled on one virtual desktop over to a different virtual desktop now keeps them tiled as expected. The focus may be on the imminent 6.4 release, but work on what comes next never really stops. Looking ahead, development on Plasma 6.5 is already well underway. Just last week, the KDE team brought several performance improvements to Plasma 6.5.0. This week, the team fixed a nagging bug that sometimes caused the Networks widget to think a hotspot was still enabled after disconnecting from Wi-Fi. On the features side, the System Settings' Fonts page now prevents you from breaking your system entirely by setting fonts below 4pt. In addition to that, switching time spans in the Info Center’s energy page now features smooth graph animations. Performance-wise, kwriteconfig should also be faster, allowing changes you made to the keyboard layout using the tool to reflect immediately.
    • Display Driver Uninstaller (DDU) 18.1.1.4 by Razvan Serea Display Driver Uninstaller (DDU) is a utility for completely removing AMD/NVIDIA/INTEL graphics drivers and related packages from your system, attempting to eliminate all leftovers (including registry entries, folders and files, driver store). Though AMD/NVIDIA/INTEL drivers can usually be removed via the Windows Control Panel, this uninstaller tool was created for situations where standard uninstall fails, or when you need to fully remove NVIDIA or ATI graphics card drivers. After using this driver cleaner, your system will behave as though it’s the first time you’re installing a new driver—similar to a fresh Windows installation. As with all such tools, we recommend creating a restore point beforehand, allowing you to undo changes if issues arise. If you're having trouble installing an older or newer driver, try it—there are reports that it resolves such problems. Recommended usage: The tool can be used in Normal mode but for absolute stability when using DDU, Safemode is always the best. Make a backup or a system restore (but it should normally be pretty safe). It is best to exclude the DDU folder completely from any security software to avoid issues. You do NOT need to uninstall the driver prior using DDU. Requirements: .NET Framework 4.8 Compatible with Windows 7, 8, 8.1, 10, and 11 (32-bit or 64-bit) Note: Using on Insider Preview builds is at your own risk. Display Driver Uninstaller (DDU) 18.1.1.4 changelog: Intel: Added NPU presence detection before removing shared DLL files (these were previously left to prevent potential NPU-related issues). Intel: Added optional NPU removal Improved "Extension" driver removal process. Updated several translations. Download: Display Driver Uninstaller 18.1.1.4 | 1.7 MB (Freeware) Download: DDU Portable | 1.2 MB Links: Display Driver Uninstaller Home Page | Screenshot | Forum Get alerted to all of our Software updates on Twitter at @NeowinSoftware
    • That is what I also think to a point. How is 26 necessarily different than just another iteration like 18, 19, 20, etc? At first I think it would be better for Apple to use 2026, 2027, and then maybe truncate it to just 28, 29, and so on. Granted, I also think it makes more sense to use the year when it was released (2025 or 25), not 26/2026. Maybe Apple's thinking is as stated by Aditya that the bulk of a release being the current release is during the following year (2026, for example) after it is released (2025, for example). There are other examples of these sorts of things. In the NBA, the season has always started in the Fall and ends in the Spring. When the season ends is how the season is named. So, this is the 2025 NBA season and the Pacers and Thunder are playing to be the 2025 NBA Champions. The NFL starts in the Fall and the end of the season is always in the beginning of the next year as well. The Super Bowl was played on February 9, 2025, but that was the end of the 2024 NFL season. So, contrary to the NBA, the NFL names it season based on when it starts, not when it ends. Maybe that is because more of the NFL season is played at the end of the year (2024 in the most recent example) whereas most of the NBA season is played in the first half of the following year (2025 in the current example).
  • Recent Achievements

    • Week One Done
      abortretryfail earned a badge
      Week One Done
    • First Post
      Mr bot earned a badge
      First Post
    • First Post
      Bkl211 earned a badge
      First Post
    • One Year In
      Mido gaber earned a badge
      One Year In
    • One Year In
      Vladimir Migunov earned a badge
      One Year In
  • Popular Contributors

    1. 1
      +primortal
      495
    2. 2
      snowy owl
      252
    3. 3
      +FloatingFatMan
      251
    4. 4
      ATLien_0
      228
    5. 5
      +Edouard
      191
  • Tell a friend

    Love Neowin? Tell a friend!